For a specific form you'll need to create the following folder: /App_Plugins/UmbracoForms/Data/forms/{FormId}/ (FormId needs to be an existing form id, you can find the id of the form in the URL when you are on the form)
As an example if your form id is 85514c04-e188-43d0-9246-98b34069750c then you can overwrite the form view by adding the Form.cshtml file to the directory First copying the default one and then making your changes is the best way to get started /App_Plugins/UmbracoForms/Data/forms/85514c04-e188-43d0-9246-98b34069750c/Form.cshtml
Then I think that you can do some thing like this directly in on of your templates.
@If(CurrentPage.DocumentTypeAlias == "SpecialForm"){
@Umbraco.RenderMacro("FormsRenderForm", new {FormGuid="85514c04-e188-43d0-9246-98b34069750c"})
}else
{
@Umbraco.RenderMacro("FormsRenderForm", new {FormGuid="3673bf87-e96e-41d0-a1d9-831ed8412205"})
}
Remember to change the form GUID´s so it match your case.
yesterday I was fooling around with this problem and found a different solution.
In the document type SpecialForm I have a FormPicker.
In the template I render the form the normal way:
@Umbraco.RenderMacro("umbracoformsRenderForm", new {FormGuid="6bf71d72-5186-416f-b0bb-0bedac65d66a"})
On the form Partial View I compare the Guid of the current form and the special form. If it's a match I use the special layout else I use the default form.
Now I can access content of the SpecialFormsNode with:
SpecialFormNode.GetProperty("img1").Value;
I don't know if this is the most efficient way to go, but for me the advantage is that I'm able to change both layouts in one partial view that I can access via Umbraco without the use of Visual Studio.
I need to acces media from the forms.cshtml but the namespace doesn't exist and I have no idee how to include it.
@Include doesn't work becouse forms uses @model and there can only be one @model in a partial view...
Any thoughts?
Edit: I was able to get the Id of the image I want but I can't get the URL or the Name...
Render forms partial view directly in template
Hi all,
I have taken on a challenge with umbraco forms.
I need to load a different forms.cshtml on one DocumentTypeAlias. I thought of changing the forms.cshtml to
But offcourse the name CurrentPage doesn't exist...
I also need to load a different image on every FormStep. The problem with this is the same as the problem discribed above... I can't do
Can anybody point me in the right direction? There is no documentation of Forms that I can find...
Who can point me in the right direction?
Thanks, Frans
Hi Frans,
If you run the latest nightly of Umbraco Forms then you have the options to customizing for a specific form. http://nightly.umbraco.org/UmbracoForms/nightlies/
For a specific form you'll need to create the following folder: /App_Plugins/UmbracoForms/Data/forms/{FormId}/ (FormId needs to be an existing form id, you can find the id of the form in the URL when you are on the form)
As an example if your form id is 85514c04-e188-43d0-9246-98b34069750c then you can overwrite the form view by adding the Form.cshtml file to the directory First copying the default one and then making your changes is the best way to get started /App_Plugins/UmbracoForms/Data/forms/85514c04-e188-43d0-9246-98b34069750c/Form.cshtml
Then I think that you can do some thing like this directly in on of your templates.
Remember to change the form GUID´s so it match your case.
Hope this helps,
/Dennis
yesterday I was fooling around with this problem and found a different solution.
In the document type SpecialForm I have a FormPicker. In the template I render the form the normal way:
On the form Partial View I compare the Guid of the current form and the special form. If it's a match I use the special layout else I use the default form.
Now I can access content of the SpecialFormsNode with:
I don't know if this is the most efficient way to go, but for me the advantage is that I'm able to change both layouts in one partial view that I can access via Umbraco without the use of Visual Studio.
Does anyone foresee a problem with this solution?
Still one problem left....
I need to acces media from the forms.cshtml but the namespace doesn't exist and I have no idee how to include it. @Include doesn't work becouse forms uses @model and there can only be one @model in a partial view...
Any thoughts?
Edit: I was able to get the Id of the image I want but I can't get the URL or the Name...
is working on a reply...