Sonelal Singh's Content
There have been 8 items by Sonelal Singh (Search limited from 27-October 19)
I have a question on previous forum(mentioned below)
How can I use below code when we have to use category with multiple fields(for example editing/adding user info).
I have two tables(users and category) like below -
- "users" table have following fields --->user_id,name,gender,category.
- "category" table have following fields ---> id,category,parent_id
Here how can I populate category like when I am using two tables.
Thanks in advance.
How can I use your code when we have to use category with multiple fields(for example editing user info).
For example -
users table have following fields --->user_id,name,gender,category
and category table have following fields ---> id,category,parent_id
I am not able to figure out how can I use category field with other tables.
I want to add email id validation such that email id must be of same domain not other domain.
For this I have written below code -
$crud->required_fields('empcode', 'firstname', 'email', 'password');
$crud->set_rules('email', 'Email', 'validate_emailid');
and I have defined "validate_emailid" function in same controller like below -
I have calculated an age by date of birth(dob) field from my database and I am able to calculate age and display it on list page.
But on view/read page all fields value displaying as expected, except age. Below is my code -
So what is wrong with my code,why age is not showing on read page.
Note:- I am using version 1.4.2
Thanks for your reply.
In database my field name is "create_date" and date type is "timestamp" and default value is "CURRENT_TIMESTAMP".
But when I fetch and displaying this field in front end it display like "30/11/1999" (d/m/y) format.
I want to display this field like "1999-11-30".
I have applied you suggestion in my code like below -
$crud->callback_columns('created_date', array($this, 'callback_date'));
and in same controller I have created callback function like below
But I am getting below error
Call to undefined method Grocery_CRUD::callback_columns()
I have a field(create_date) in USER table.This stores default datetime(2015-07-01 03:05:34) value in the table as its value.
When I am displaying this value in front end it display as "01/07/2015 - 00:00". But I want to display date as "2015-07-01", To achieve this I used this code $crud->field_type('created_date', 'date') for formatting.So now it display as "01/07/2015".
So my question is how can I display this date as "2015-07-01".