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.

Archive

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

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

made a search form w3 compatible...


Reply

8 Posts   2612 Views

Avatar
Nicolaas

31 May 2007 at 12:34pm (Last edited: 31 May 2007 12:34pm), Forum Moderator, 213 Posts

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

3 June 2007 at 4:09pm Community Member, 1 Post

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

4 June 2007 at 11:46am (Last edited: 4 June 2007 11:47am), Forum Moderator, 921 Posts

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

5 June 2007 at 12:22am Forum Moderator, 213 Posts

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

5 June 2007 at 7:52pm (Last edited: 5 June 2007 7:53pm), Forum Moderator, 801 Posts

<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

5 June 2007 at 10:23pm (Last edited: 5 June 2007 10:27pm), Forum Moderator, 921 Posts

<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

28 September 2007 at 11:01pm (Last edited: 28 September 2007 11:01pm), Community Member, 501 Posts

@ 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

1 January 2008 at 5:01am Community Member, 19 Posts

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

This would prevent the overwriting at next upgrade ...

Roland