Jump to content


pbcomput

Member Since 18 Dec 2013
Offline Last Active Apr 07 2014 01:10 PM
-----

Topics I've Started

Show status on read mode

07 April 2014 - 12:58 PM

Hello,

 

I want to show the status name on read mode. For user status I took ENUM type with 'a' for Active and 'i' for Inactive.

 

Its working properly on Add and Edit, for that I did like below

$crud->field_type('ad_status','dropdown', array('i' => lang('inactive'), 'a' => lang('active')));

Its showing me Active and Inactive texts in dropdown when I go to add or edit.

 

But, In read mode it's showing me 'a' or 'i' but I want to show Active and Inactive text on read mode. Can any one help me to show the status in texts.

 

Thanks for your help.! :)


dependent dropdown plugin issue

05 April 2014 - 11:56 AM

Hi,

 

I am using dependent dropdown plugin of GC library. But its not working on my GC. Can any one please look at my code and tell me where I am doing wrong?

 

my code and post is here http://www.grocerycr...ary/#entry11006

 

Thanks for the help.!

 

 


callback_before_insert not working for created date

13 March 2014 - 07:23 AM

Hello,

 

I want to add created date when the record adds to db. For that I used callback_before_insert() but Its not working, Don't know why. Can anyone please check my code and tell me where I am doing wrong?

function newsletter_template ()
	{
		if($this->checkSession())
		{
			$crud = new grocery_CRUD();
				
			$crud->set_table('newsletter_template');
			$crud->set_subject(lang('newsletter_template'));
			$crud->columns('nt_id','nt_name','nt_created_dt');
			$crud->fields('nt_id','nt_name','nt_content','nt_created_dt');
			$crud->required_fields('nt_name','nt_content');
			$crud->unique_fields('nt_name');
			
			$crud->change_field_type('nt_id','invisible');
			$crud->change_field_type('nt_created_dt','invisible');
			
			$crud->display_as('nt_id',lang('nt_id'))
				 ->display_as('nt_name',lang('nt_name'))
				 ->display_as('nt_content',lang('nt_content'))
				 ->display_as('nt_created_dt',lang('nt_created_dt'));
				 
			$crud->callback_before_insert(array($this,'nt_created_dt','created_dt'));
				
			$main_content = 'backoffice/newsletter_template';
			$output  = $crud->render();
			$this->_Crud_output($output,$main_content);
		}
	}
	
	function created_dt($post_array)
	{
	  	$post_array['nt_created_dt'] = date('Y-d-m');
		return $post_array;
	}

Thanks for your help.  :)


How to modify selectbox

18 December 2013 - 01:44 PM

Hi,

 

I am new to grocery crud. Please help me to achieve the following output on select box.

 

I took ENUM type on table of user to manage user type. I am getting below output.

 

<select id="field-member_type" name="member_type" class="chosen-select chzn-done" data-placeholder="Selectionner Member type">

<option value=""></option>

<option value="u">user</option>

<option value="s">student</option>

</select>

 

But I need the output like this.

 

<select id="field-member_type" name="member_type" class="chosen-select chzn-done" data-placeholder="Selectionner Member type">

<option value=""></option>

<option value="u">user</option>

<option value="s">student</option>

</select>

 

help me to solve this issue.

 

Thanks.

 


How to modify select option value

18 December 2013 - 01:36 PM

Hello,

 

I am new to Grocery Crud. I am working on user module. I want to modify the select box of user type on User Add/ Edit form.  User have 2 types, and I took ENUM data type to manage user's type. 

 

Currently I am getting like this

 

<select id="field-member_type" name="member_type" class="chosen-select chzn-done" data-placeholder="Selectionner Member type">

<option value=""></option>

<option value="u">u</option>

<option value="a">a</option>

</select>

 

I need output this select box like below

 

 

<select id="field-member_type" name="member_type" class="chosen-select chzn-done" data-placeholder="Selectionner Member type">

<option value=""></option>

<option value="u">User</option>

<option value="a">Admin</option>

</select>

 

I know the callback method but I want to know if there is any other method to achieve this.

 

Thanks,

Palak