Creating forms - how?

Jun 14, 2012 at 3:55 PM
Edited Jun 14, 2012 at 4:10 PM

I'm trying to convert an existing site to RazorC as a test. I can't figure out how to make my contact form work. It is a typical Razor C# form. It doesn't work in a widget or in the main body. Is it possible to do anything other than text, images, and media files in RazorC pages? Thanks.

Edit: I found the discussion at that gives the basics. However, RazorC won't let me put that widget in the main body where I need it - only in a section. How can I get a widget into the body?

Please forgive my ignorance. CMS software is a new concept to me and I'm still having trouble getting my mind around it.

Jun 14, 2012 at 4:35 PM
Edited Jun 14, 2012 at 4:35 PM

You can download free contact form and change it to your needs here - go to add-ons

When you edit page you can disable "body" part of you site, and use zone below @RenderBody() to display any widget you want ex.

in demo layouts you will find:
@RenderSection("rcBottom",false )

so you an use body to render main text of your page and rcBottom to render contact form below that, or yo can disable body part and use rcBottom section to insert as many as you need widgets (contact forms, galleries, etc)


Take a look here STONE text uses body of the page and gallery below is inside rcBottom section

or here the body is disabled and testimonials it is addon (with paging) inside the zone,  then below you have 2 more widgets inside that zone

Jun 14, 2012 at 4:56 PM
Edited Jun 14, 2012 at 5:05 PM

Thank you. I wrapped my form in the ARTICLE container tag that I normally use to format the body of the site and did what you suggested. Working now.

May 20, 2013 at 12:31 PM
I am also looking for creating custom forms. But I do not understand the method you suggest.

Can you please explore the custom form page creation in detail?

One more thing, can I add my razor code directly to the page creation body part?

May 21, 2013 at 3:07 AM

under _rcTemplates create page ex. _rcMyForm.cshtml (build it as you would any web page), if this will be form build one
Then you would be able to access it as template for new widget , so build widget based on it and use it in your page (take a look at files that are already under rcTemplates)

The other option would be to build addon - you can download free contact addon and see how it is done

"One more thing, can I add my razor code directly to the page creation body part? "
if you ask if you can mix html and razor code in the html editor (create/edit pages) - NO , the content of that is stored in db, so it would not work.