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.

General Questions /

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

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

Adding Contact Form in CMS


Reply


3 Posts   574 Views

Avatar
nat.pike

Community Member, 19 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
netnerd85

Community Member, 42 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, 5513 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.