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.

Form Questions

How to take out 'Form Legend' tag


Reply

16 Posts   3640 Views

Avatar
dio5

28 January 2009 at 4:17am Community Member, 501 Posts

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

29 January 2009 at 9:57am Community Member, 1 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

Avatar
Willr

29 January 2009 at 3:42pm (Last edited: 29 January 2009 3:42pm), Forum Moderator, 5511 Posts

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

1 March 2009 at 10:31am (Last edited: 1 March 2009 10:32am), Community Member, 6 Posts

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

20 March 2009 at 4:48am Community Member, 21 Posts

Thanks willr, your solution it works

Avatar
david_nash

1 May 2009 at 12:47pm Community Member, 55 Posts

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

1 May 2009 at 1:57pm Forum Moderator, 5511 Posts

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

1 May 2009 at 2:54pm Community Member, 55 Posts

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