Jump to content


Change the field width in edit/add form

form

  • Please log in to reply
2 replies to this topic

#1 Cèsar Martí

Cèsar Martí

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts

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.

#2 naufal

naufal

    Member

  • Members
  • PipPip
  • 18 posts

Posted 13 March 2012 - 01:18 PM

Use this function
change_field_type

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

Use callback to change the width http://www.grocerycr..._insert_example

#3 Cèsar Martí

Cèsar Martí

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts

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">';
    }






Also tagged with one or more of these keywords: form

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users