⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Change the field width in edit/add form



cesaret_2000
  • profile picture
  • Member

Posted 13 March 2012 - 12:02 PM

Hi!

Can I change the default field width in edit/add form? For exemple in an integer or text field.

Thanks.

naufal
  • profile picture
  • Member

Posted 13 March 2012 - 13:18 PM

Use this function
 change_field_type 


Here it is the list of available field type:[list]
[*]integer
[*]true_false
[*]string
[*]text
[*]date
[*]datetime
[*]enum
[*]hidden
[*]invisible
[*]password
[/list]
It's well documented http://www.grocerycr...ange_field_type

Use callback to change the width http://www.grocerycrud.com/examples/callback_before_insert_example

cesaret_2000
  • profile picture
  • Member

Posted 14 March 2012 - 08:39 AM

Thanks Naufal.

It's working:


$crud->change_field_type('aforament', 'integer');
$crud->callback_edit_field('aforament',array($this,'edit_aforament_callback'));


And I change the style in the callback, now it's the same with than the select boxes:


function edit_aforament_callback($value, $primary_key)
{
return '<input type="text" value="'.$value.'" name="aforament" class="numeric" maxlength="9" style="width:238px">';
}