Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » made a search form w3 compatible...

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

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

Page: 1
Go to End
Author Topic: 2468 Views
  • Nicolaas
    Avatar
    Forum Moderator
    213 Posts

    made a search form w3 compatible... Link to this post

    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?

  • wongfeihung
    Avatar
    Community Member
    1 Post

    Re: made a search form w3 compatible... Link to this 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.

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: made a search form w3 compatible... Link to this post

    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

  • Nicolaas
    Avatar
    Forum Moderator
    213 Posts

    Re: made a search form w3 compatible... Link to this post

    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.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: made a search form w3 compatible... Link to this post

    <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).

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: made a search form w3 compatible... Link to this post

    <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

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: made a search form w3 compatible... Link to this post

    @ 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

  • mundgold
    Avatar
    Community Member
    19 Posts

    Re: made a search form w3 compatible... Link to this post

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

    This would prevent the overwriting at next upgrade ...

    Roland

    2468 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.