Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » How to take out 'Form Legend' tag

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

Page: 1 2
Go to End
Author Topic: 3606 Views
  • dio5
    Avatar
    Community Member
    501 Posts

    Re: How to take out 'Form Legend' tag Link to this post

    To come back on your legend question:

    you have to do it on the form, not on the fieldset.

    So I guess in your case this would become:

    instead of

    return new SearchForm($this, "SearchForm", $fields, $actions);

    do

    $form = new SearchForm($this, "SearchForm", $fields, $actions);
    $form->setLegend("My Legend");

    return $form

    Although I'm not sure which SS version you're using and if this was part of 2.2.3 already...

  • andi68
    Avatar
    Community Member
    1 Post

    Re: How to take out 'Form Legend' tag Link to this post

    Hi Ian,

    if you just want to take out the "Form legend Tag", go to directory sapphire->templates, open the "SearchForm.ss" and delete it.

    regards, Andi

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: How to take out 'Form Legend' tag Link to this post

    andi68, editing the sapphire/ templates is often a bad idea as when you are upgrading SS, its likely to break. As for getting rid of the legend you should just be able to do this in your CSS file

    form legend {
    display: none;
    }

  • maksfeltrin
    Avatar
    Community Member
    6 Posts

    Re: How to take out 'Form Legend' tag Link to this post

    Copy SearchForm.ss from "sapphire/templates" into "mysite/templates" (or mytheme/templates). Then remove the "<legend>Search</legend>" tag. This way there are no issues in case of framework updates.

  • d-virus
    Avatar
    Community Member
    21 Posts

    Re: How to take out 'Form Legend' tag Link to this post

    Thanks willr, your solution it works

  • david_nash
    Avatar
    Community Member
    55 Posts

    Re: How to take out 'Form Legend' tag Link to this post

    Thanks maksfeltrin, I think your solution is the best.

    Willr - the CSS way does work, but I'm obsessive about my code validating with no errors and warnings.

    Is that meaningless legend tag there for the future?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: How to take out 'Form Legend' tag Link to this post

    It shouldn't be meanless - it should have some text in it at some point. Maybe I will change this for 2.4. I didn't want to add it for 2.3 as it would likely break alot of sites.

  • david_nash
    Avatar
    Community Member
    55 Posts

    Re: How to take out 'Form Legend' tag Link to this post

    No worries Will, understood - I feel a little bad about being critical because overall SilverStripe is freakin' awesome!

    3606 Views
Page: 1 2
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.