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.

Form Questions /

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

How to take out 'Form Legend' tag


Go to End


16 Posts   6474 Views

Avatar
dio5

Community Member, 501 Posts

28 January 2009 at 4:17am

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

Avatar
andi68

Community Member, 1 Post

29 January 2009 at 9:57am

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

Avatar
Willr

Forum Moderator, 5523 Posts

29 January 2009 at 3:42pm

Edited: 29/01/2009 3:42pm

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;
}

Avatar
maksfeltrin

Community Member, 6 Posts

1 March 2009 at 10:31am

Edited: 01/03/2009 10:32am

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.

Avatar
d-virus

Community Member, 21 Posts

20 March 2009 at 4:48am

Thanks willr, your solution it works

Avatar
david_nash

Community Member, 55 Posts

1 May 2009 at 12:47pm

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? :-)

Avatar
Willr

Forum Moderator, 5523 Posts

1 May 2009 at 1:57pm

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.

Avatar
david_nash

Community Member, 55 Posts

1 May 2009 at 2:54pm

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

Go to Top