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

Whats the Best way to store formatted text in a form?


Go to End


2 Posts   1668 Views

Avatar
Jakxnz

Community Member, 36 Posts

4 December 2009 at 1:26pm

Hey Crew.

I've been trying to store html formatted text from a form so that users entering a 'description' will have their text formatting saved on entry:

	public function SubmissionForm() {
		$fields = new FieldSet();

                $fields->push(new TextareaField('Description', 'Description'));


                $actions = new FieldSet();
		$actions->push(new FormAction('SubmissionFormAction', 'Submit'));

		return new Form($this, 'SubmissionForm', $fields, $actions);
        }

In the back end of the CMS I can use HTMLEditorField without issue. But I don't want A: The user to be able to use a WYSIWYG editor and B: Know that their input is being saved as HTML text.

Whats the best way to get this?

A really good example is this Content field I'm filling out right now! hah.

Avatar
Jakxnz

Community Member, 36 Posts

9 December 2009 at 12:21am

Is this something thats straight forward or is it a more complicated topic?