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.

Archive /

Our old forums are still available as a read-only archive.

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

made a search form w3 compatible...


Go to End


8 Posts   3022 Views

Avatar
Nicolaas

Forum Moderator, 224 Posts

31 May 2007 at 12:34pm

Edited: 31/05/2007 12:34pm

by adding a div tag to \silverstripe\sapphire\templates\SearchForm.ss

now reads:

<form $FormAttributes>
<div>
<% control Fields %>
$FieldHolder
<% end_control %>
<% control Actions %>
$Field
<% end_control %>
</div>
</form>

is this the right way to go about it? I am scared that when I do my next upgrade of SS, I will loose this tweak to sapphire.

What shall I do?

Avatar
wongfeihung

Community Member, 1 Post

3 June 2007 at 4:09pm

Nicolaas, the form is already a block element and therefore the div inside the form is redundant. What are you trying to accomplish? This doesn't make it w3 compatible but just adds extra markup that is probably not needed.

Avatar
Sean

Forum Moderator, 922 Posts

4 June 2007 at 11:46am

Edited: 04/06/2007 11:47am

Perhaps what you're trying to do, instead, is add a <div> where a <fieldset> is probably required.

All <form> elements require a <fieldset> inside it to make it standards compliant. I guess this is something that was overlooked...

Cheers,
Sean

Avatar
Nicolaas

Forum Moderator, 224 Posts

5 June 2007 at 12:22am

hmmmm, sounds like we have different ideas of compliance. When I check my xhtml with W3 then I get an error message if I do not have a <p> or a <div> in the form to hold the content, so I just add a <div> or a <p>. I agree though that <form> in itself should do the trick.
Fieldset is a relatively new thing as far as I understand it, but perhaps that is the ultimate answer.

Avatar
Ingo

Forum Moderator, 801 Posts

5 June 2007 at 7:52pm

Edited: 05/06/2007 7:53pm

<fieldset> is a quite old HTML-standard, but not very frequently used. just putting some extra tags in your markup to make the validator shut up is not the right approach IMO ;-) our normal Form.ss already adds a <fieldset>, but this was missed in SearchForm.ss.
Sean has created an issue in our bugtracker for this a week ago, but it needs some investigation if this addition changes the layout of existing layouts (e.g. indentation or borders).

Avatar
Sean

Forum Moderator, 922 Posts

5 June 2007 at 10:23pm

Edited: 05/06/2007 10:27pm

<fieldset> still gives you the ability to place <legend> elements, a great usability feature. ;-)

It's doubtful you're going to need multiple fieldsets for SearchForm, but it's also nice to split up different sections of your form if it's for anything else. For example: 'Contact' fields would have it's own <fieldset> element, and a <legend> element too, so it labels that 'set' or 'group' of fields logically.

It really should be used, plus it also does give you more flexibility in styling forms with the extra element, like different background styles... ;-)

All forms created using SilverStripe include the <fieldset> element as Ingo said, and as such it was probably just 'forgotten' in the SearchForm. Either we leave it for 2.1 or we fix it in the 2.0.2 or 2.0.3 subsequent releases, and just add a note in the changeset that we've done this for validation reasons, and W3C compliance which is important. :-)

Cheers,
Sean

Avatar
dio5

Community Member, 501 Posts

28 September 2007 at 11:01pm

Edited: 28/09/2007 11:01pm

@ Sean:

Any news on this yet?

Having multiple fieldsets in some forms is truly a must. Now every form seems to have only one fixed fieldset by default (?) while in a lot of cases you really want to group different sections in different fiedsets. If there is a way to do it, I would appreciate it a lot if someone told me.
Having the option to add a legend would be great too.

Many thanks

Dieter

Avatar
mundgold

Community Member, 19 Posts

1 January 2008 at 5:01am

You could put that modified copy of "SearchForm.ss" into /silverstripe/yousite/templates/SearchFrom.ss

This would prevent the overwriting at next upgrade ...

Roland