enum form type, label not closing

edited June 2016 in Bug Reports
Came across an issue with the form module, whereby the label's for enum field types weren't being closed. Traced the issue to fuel library form_builder.php. Created a pull request for it, but not sure it won't cause additional issues.

Cheers

Comments

  • edited 4:55PM
    just noticed an issue with it, now the html is correct. you have to click on the label to see the option list, doh
  • edited 4:55PM
    I could do with a bit of guidance on this issue.

    We have an issue styling forms with enum fields as the select is in the label tag. And if we correct the html then the select options don't appear till the label has been clicked which is no good for users.

    Any idea's?
  • edited 4:55PM
    Can you show the $field array code that is getting passed to Form_builder as well as the generated HTML code you are seeing?
  • edited June 2016
    Here's the $from_fields array from the rendered_vars function

    array (
    'department' =>
    array (
    'type' => 'enum',
    'name' => 'department',
    'label' => 'Department',
    'attributes' => 'class=\'wrapper\'',
    'options' =>
    array (
    'general' => 'General',
    'test_drive' => 'Test Drive',
    'reserve' => 'Reserve',
    'video' => 'Request a Video',
    ),
    'block_name' => 'enum',
    ),
    ......
    )


    and the generated HTML for the field:
    <label for="department" id="label_department">Department <p> <select name="department" id="department" class="wrapper"> <option value="General" label="General">General</option> <option value="Test Drive" label="Test Drive">Test Drive</option> <option value="Reserve" label="Reserve">Reserve</option> <option value="Request a Video" label="Request a Video">Request a Video</option> </select> </p> </label>
  • edited 4:55PM
    Try setting the type to just a "select". There seems to be a bug with the rendering of labels on enum field types in that scenario when there are more then 2 options and it goes into a dropdown select.
  • edited 4:55PM
    Cheers, that's sorted it. I hadn't spotted the 'select' type. it solves the other issues we'd run into as well, such as not place holder and having to click the label to activate the enum options.

    Thanks
  • edited 4:55PM
    this continues to be an issue.

    when using a select form type and adding before_html and after_html to the type, the form field doesn't render the options until you click on the label.

    here's the array:

    array (
    'department' =>
    array (
    'type' => 'select',
    'name' => 'department',
    'label' => 'Department',
    'attributes' => 'class=\'wrapper\'',
    'options' =>
    array (
    'general' => 'General',
    'test_drive' => 'Test Drive',
    'reserve' => 'Reserve',
    'video' => 'Request a Video',
    ),
    'block_name' => 'select',
    'before_html' => '
    ',
    'after_html' => '
    ',
    ),
    ....
    )

    and the html:

    <div class="department"> <label for="department" id="label_department">Department</label> <p></p><div class="styled-select"><select name="department" id="department" class="wrapper"> <option value="general" label="General">General</option> <option value="test_drive" label="Test Drive">Test Drive</option> <option value="reserve" label="Reserve">Reserve</option> <option value="video" label="Request a Video">Request a Video</option> </select> </div><p></p> </div>
  • edited 4:55PM
    I'm not quite sure I follow.
  • edited June 2016
    We've sorted this out now, with a custom type.

    But, when the select type rendered it wasn't showing any options. The first would appear when you clicked on the label, then you have to click on the control again to view the list.
Sign In or Register to comment.