Hi,

I am currently trying to set the (bootstrap) style for the options in a Radiogroup but having trouble adding an attribute class to the <span> tag for each option.

I would like the form output to look like this:

<form action="" method="post">
    <fieldset>
        <legend>sex</legend>
        <span>
            <span class="radio">
                <input name="sex" type="radio" value="m" />
                <label>Male</label>
            </span>
            <span class="radio">
                <input name="sex" type="radio" value="f" />
                <label>Female</label>
            </span>
            <span class="radio">
                <input name="sex" type="radio" value="a" />
                <label>Alien</label>
            </span>
        </span>
    </fieldset>
    <div>
        <input name="submit" type="submit" value="Submit" />
    </div>
</form>

I know it is possible to manually set an option container attribute as follows:

elements:
  - type: Radiogroup
    name: sex
    label: sex
    options:
      - [ 'm', 'Male' ]
      - [ 'f', 'Female' ]
      - value: a
        label: Alien
        container_attributes: <------------- here
          class: radio

however I would like this attribute to be applied to all options automatically since I am actually retrieving the options dynamically from the database rather than setting them manually in the form config. I tried fiddling with the layout in the default_args hash but all I could manage to change were the outer elements of the Radiogroup rather than the inner <span> which wrap around the options themselves.

Any assistance with this would be greatly appreciated.

Stuart.





_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to