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.

Archive /

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

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

RequiredFields() on a LiteralField?


Go to End


5 Posts   2182 Views

Avatar
Todd

31 Posts

1 November 2007 at 5:58am

Hi Guys,

Can you use RequiredFields() on a LiteralField?

Here is my literalfield:

new LiteralField("Comments", "<label class='left'>Comments:</label><br //><textarea name='Comments' rows='5' cols='20'></textarea>")

Thanks,

Todd

Avatar
Sam

Administrator, 690 Posts

1 November 2007 at 8:22am

Possibly, but I'm not sure - why not use a TextareaField?

Avatar
Todd

31 Posts

1 November 2007 at 8:35am

Hi Sam,

I would. But there would be formatting issues, unless you can tell me how to add a <br /> between "Comments:" and the textarea.

Todd

Avatar
Sean

Forum Moderator, 922 Posts

1 November 2007 at 9:26am

Edited: 01/11/2007 9:27am

Instead of adding a <br /> you can use CSS to make the width of the label long enough that it pushes down the textarea field below the label. I assume that's what you're after.

Most likely it would be, this, on a TextareaField (assuming you called the field 'Comments'):

form #Comments label {
width: 100%;
display: block;
}

Cheers,
Sean

Avatar
Todd

31 Posts

1 November 2007 at 4:58pm

Hi Sean,

I'll give this a try.

Many thanks.

Todd