Form builder enum type and 'checked' status

edited December 2013 in Share
Hi,

I'm creating an array of radio buttons using Form Builder (with Fuel v1), and have declared them like so:
$feedback_options = array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5'); $feedback_select_type = 'radios'; $feedback_radio_array = array( 'type' => 'enum', 'mode' => $feedback_select_type, 'options' => $feedback_options, 'spacer' => NULL, 'row_class' => 'radio-array', 'checked' => FALSE );
When rendered the 1st radio is checked. If I change the 'checked' key to NULL, the state is the same. I tried setting value to NULL and empty and this also changed nothing.

Am I missing something?

Comments

  • edited December 2013
    Additionally, using the render_divs method of Form Builder, when a field type of 'fieldset' is used, I'm getting

    ... </tbody> </table> </fieldset> <table><tbody>
    around the last fieldset tag rendered?
  • edited 4:27PM
    You can set a "null" parameter to TRUE which will uncheck the first option. Also, I've posted a fix for the render_divs HTML. Test it out and let me know if there are any additional issues.
  • edited December 2013
    The render_divs() fix works fine in the example I had, many thanks! The granularity of control over the form is quite comprehensive in Form Builder!

    Regarding the default checked status of the radio buttons,which parameter specifically should set to TRUE?
  • edited 4:27PM
    See the example below:
    $feedback_radio_array = array( 'type' => 'enum', 'mode' => $feedback_select_type, 'options' => $feedback_options, 'spacer' => NULL, 'row_class' => 'radio-array', 'checked' => FALSE, 'null' => TRUE );
  • edited 4:27PM
    Oh, 'null' as a key. Yes that works. Incidentally, null isn't listed as amongst the "Universal Field Attributes" here: http://docs.getfuelcms.com/general/forms - should it be?
  • edited 4:27PM
    You are right. It should be added, however, it really only makes sense for enums. I'll add that.
Sign In or Register to comment.