Jump to content

Grouping fields in a form: how?


Mike-it
 Share

Recommended Posts

I have a script that generates a bunch of inputfields and then outputs a form. I am trying to group visually these things. Basically, I'd like the output to have the fields grouped by some <div>s.

I know I can use fieldsets for this, but in this case I can't, because the form is used by other functions (Padloper's) that assume it has a flat structure (no nested fields). So I need a way to inject some extra markup into a flat list of fields.

I thought about using an After hook to InputField::render to inject the extra <div>s and </div>s that I need, but it does not work, because while I can indeed inject some markup this way, it is still wrapped by the code that usually wraps the element, i.e. <div class="InputField..."ecc>, so there is no way to output markup that act as a container of several fields.

Finally, using the setMarkup method of the form allows me to control the rendering of the fields, but it seems that it works on all fields or nothing. I haven' been able to change it just for a single field of the form.

Any idea or suggestion?

Thanks

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...