First off, thank you for reading, second I have never used razor so I'm still learning.
The issue: I want to create my own "contact form" that can be managed from the back-end of Umbraco for the users to add/edit/remove fields. The first problem is, I can't find any good packages that full fill my requirements. So, I want to create my own "contact form" by using the Umbraco macro script functionality.
My solution:
I create a document type with properties added (without template).
I add my macro script to the specified node.
I add a subnode based on the document type earlier.
Now I want to read the properties of the subnode so I can dynamiclly create the form.
The problem: Razor doesn''t show any error messages other than:
Error loading RazorScript
To solve this I tried to changed the web.config file to set debug from false to true and add querystring "?umbDebugShowTrace=true". But this doesn't work.
After testing line by line I noticed the error is caused by this line of my chtml code:
Thank you for your quick response. The solution you specified does work, however I want to show the element itself.
For example: If there is a property with type "Checkbox" I want to show a checkbox, not the Alias. If there is a propery with type "Textbox" I want to show a textbox.
I hope I made myself clear enough for you to understand.
Oh well, it was just a theory. I know about the Contour package, but I have a cheap budget and I like to build it myself. I solved the problem by using a static (un-changeable from back-end) contact form, it will be good for now.
Razor get childnode properties umbraco item
Dear people,
First off, thank you for reading, second I have never used razor so I'm still learning.
The issue:
I want to create my own "contact form" that can be managed from the back-end of Umbraco for the users to add/edit/remove fields. The first problem is, I can't find any good packages that full fill my requirements. So, I want to create my own "contact form" by using the Umbraco macro script functionality.
My solution:
Now I want to read the properties of the subnode so I can dynamiclly create the form.
The problem:
Razor doesn''t show any error messages other than:
To solve this I tried to changed the web.config file to set debug from false to true and add querystring "?umbDebugShowTrace=true". But this doesn't work.
After testing line by line I noticed the error is caused by this line of my chtml code:
Complete code:
Question:
How can I show the error message?
What am I doing wrong here? Isn't this suppose to work?
Thanks in advance,
Mike
Hey Mike,
Welcome to the forum!
This line here should only be use in templates
As you are in Razor, you can do this:
Hope that helps
Rich
Dear Rich Green,
Thank you for your quick response. The solution you specified does work, however I want to show the element itself.
For example:
If there is a property with type "Checkbox" I want to show a checkbox, not the Alias.
If there is a propery with type "Textbox" I want to show a textbox.
I hope I made myself clear enough for you to understand.
Mike
Hi Mike,
There's no magic way to do this.
I'm assuming you have different DocTypes for checkbox and textbox?
So your code would be something like:
Though I'm not sure why you don't just use Umbraco Contour?
Rich
Dear Rich Green,
Oh well, it was just a theory. I know about the Contour package, but I have a cheap budget and I like to build it myself. I solved the problem by using a static (un-changeable from back-end) contact form, it will be good for now.
Thanks for the help!
Mike
is working on a reply...