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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Adding Contact Form in CMS


Go to End


3 Posts   1655 Views

Avatar
nat.pike

Community Member, 21 Posts

29 July 2012 at 7:24pm

Hi there

I'm wanting to add a contact form to a page but want to have the ability of where it is positioned on the page.

I have used the UserForm Module in the past which is fine but it is positioned under the $content - I want the contact form within the $content.

Is there a way that I can "embed" it from within the wysiwyg editor?

I would be greatful for any feedback or if someone can give me any ideas on how I can achieve this.

Cheers

Natalie.

Avatar
jaybee

Community Member, 49 Posts

30 July 2012 at 11:39am

You could use a "shortcode" type thing. Basically what you want to do is a find and replace on the Content. Use a tag/shortcode in the WYSIWYG editor like [UserForm id=5] and search for that string using RegEx. You'll need to load the UserForm and get it's render HTML into the Content variable of the page (not sure how to get the html of the user form off the top of my head though). Overload the Content function on whatever page you have.

Avatar
Willr

Forum Moderator, 5523 Posts

30 July 2012 at 9:38pm

UserForms supports embedding the form within the content page (only on the same page as the form). Place $UserDefinedForm where you would like the form to display.