Welcome Guest, Not a member yet? Register   Sign In
Form Helper
#1

[eluser]Craig N[/eluser]
Just curious, what's the reasoning behind having a default maxlength of 500 on form inputs when using the form_input function in the form helper? I'm currently working on a form that, while setting the maxlength isn't completely necessary, it's useful for UI design.

Currently I just removed that default setting in the form_helper.php file and specified it in the extras variable when calling the function, however I'm always game for a more elegant solution if there's good reasoning behind it.
#2

[eluser]jcopling[/eluser]
I think that the CI User Guide has the best suggestion with how to handle additional parameters with the form_input function:

Code:
$data = array(
              'name'        => 'username',
              'id'          => 'username',
              'value'       => 'johndoe',
              'maxlength'   => '100',
              'size'        => '50',
              'style'       => 'width:50%',
            );

echo form_input($data);

// Would produce:

<input type="text" name="username" id="username" value="johndoe" maxlength="100" size="50" style="width:50%" />
#3

[eluser]Craig N[/eluser]
This is great, thanks!
#4

[eluser]wlvrn[/eluser]
I'm encountering this too and it's annoying.

Where's the logic in this? Why am I forced to add more PHP code to my view? There should be no default size or maxlength. Size should be dictated by the CSS.
#5

[eluser]Derek Allard[/eluser]
Yup, good point. maxlength and size have been removed as automatically added attributes




Theme © iAndrew 2016 - Forum software by © MyBB