Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Give a Form Fieldset an ID


Go to End


3 Posts   773 Views

Avatar
merrick_sd

Community Member, 99 Posts

16 August 2012 at 2:46am

How can i give a form fieldset an id?

or would have to do a custom template.ss form?

eg: php code

$fields = new FieldSet(
whatever

)

only gives me
front end output
<fieldset>

but i want <fieldset id="delegates">

and it needs to be on a fieldset not a div or other TAG

any ideas?

Avatar
Willr

Forum Moderator, 5523 Posts

17 August 2012 at 8:10pm

The fieldset class doesn't wrap the fields in a 'fieldset' (terrible naming). It's actually part of the template (https://github.com/silverstripe/sapphire/blob/2.4/templates/Includes/Form.ss#L10) so you'd either need to do a custom template or put the ID on a div within the fieldset.

Avatar
merrick_sd

Community Member, 99 Posts

17 August 2012 at 10:34pm

thanks for the info.
I was using a piece of javascript found at http://vipullimbachiya.com/?p=349
to duplicate fields and was stuck and thinking the js would only work on the <filedset> id, but luckily it can work on a div as well.