Form module: Attributes for form fields
Hi,
I am using the forms module and created a form. The form has a field of type number. Now I want to define a max value and a default value for the field. I entered max=10 default=1 in the attributes input field.
The generated code is
<input type="number" name="quantity" id="quantity" value="" class="numeric" required min="0" max="10000" data-decimal="0" data-negative="0" max=10 default=1 />
The browser only interprets the first max value with 10000. Why isn't the value replaced. And how can I pass the default value of 1 to the field?
Comments
To fix, in the Form_builder::create_number() method (around lines 2732-2733), you can change the default values to NULL.
I've pushed this change to the develop branch:
https://github.com/daylightstudio/FUEL-CMS/commit/ad4aee3c313ec710357a91664084670bad0d1c1a
for max value this worked. I also had to adjust the defaults array ~10 lines above and set min to NULL there to get it working for the min value.
The other question is now, how to set a default value as initial value when the form is rendered.
I think I have found another bug?
In line ~14 of the file forms/controllers/form.php the method $form->get_return_url(); returns nothing. If I try to read $form->return_url the correct value is shown.
https://github.com/daylightstudio/FUEL-CMS-Forms-Module/commit/285c2021b3f2d81be0ab647d013a5471abb3f1d9
still only name, label, field type, required and attribute visible