Im completely new to razor and have been looking at the Cultiv Razor Contact package. I dont fully grasp Razor, but I have managed to add a custom field and a select option to my contact form.
Im looking for some help on an easier way to create a select option with values that could be used multiple times.
Unfortunately we had to remove your comment on this topic as it caused an issue on the server for some reason (still under investigation). Could you please send an email with the code you pasted into that comment to pg [at] umbraco.com so I can investigate the issue further. I will repost that code here if you have not solved your issue yet. Sorry for the inconvenience.
How come the RenderOptionSet helper you are only passing in 3 parameters and not four. RenderOptionSet requires 4? They are not optional? I am probably missing something here :/. Charlie.
I could probably remove both the errorText and className parameters from that help because the options don't need either one of them. I looked at the other helpers he had in here as an example to make the options one.
With those helpers, I can get a dropdown menu to appear on the page. I've just been spinning my wheels on how to get the value from the <select></select> to appear in the resulting email.
Yes, the form itself works, as in I can get an email from it. Name, email, message fields all go through. I'm puzzled on a dropdown list because this form provided only fields for a name, email, and message as defaults. Adding more text fields is easy. Adding different types of fields, i.e. checkbox, dropdown list, radio fields is more difficult.
I'm not quite sure how to build the dropdown list into what's already going on with this file. But I am trying.
Andreas, thanks for the help. @Hmtl.DropDownListFor is throwing me an excpetion.
'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'DropDownListFor' and no extension method 'DropDownListFor' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper' could be found (are you missing a using directive or an assembly reference?) at System.Web.Compilation.AssemblyBuilder.Compile()'
I've googled it and haven't really had any luck with it. I'm not giving up though. It's something I'd like to figure out.
News to Razor - Contact Form Select Option
Hi all,
Im completely new to razor and have been looking at the Cultiv Razor Contact package.
I dont fully grasp Razor, but I have managed to add a custom field and a select option to my contact form.
Im looking for some help on an easier way to create a select option with values that could be used multiple times.
Thanks
Martin
Hi Martin
Unfortunately we had to remove your comment on this topic as it caused an issue on the server for some reason (still under investigation). Could you please send an email with the code you pasted into that comment to pg [at] umbraco.com so I can investigate the issue further. I will repost that code here if you have not solved your issue yet. Sorry for the inconvenience.
Peter Gregory
Umbraco HQ
Hi Peter,
Ive emailed yo the code that I had posted. If you didnt recieve it let me know and I'll send again.
In the meantime, if anyone knows how to add a select option and mulitple checkbox to the basic Cultiv Razor Form, any help would be grateful.
Thanks
Martin
Martin did you ever figure this out? I've been at it for a while now and can't crack this code. Lots of stuff going on in here.
I'm rendering options options like this:
Boggling my mind. I'm not getting any errors, just can't get the VALUE from the SELECT to show up in the email.
How come the RenderOptionSet helper you are only passing in 3 parameters and not four. RenderOptionSet requires 4? They are not optional? I am probably missing something here :/. Charlie.
I could probably remove both the errorText and className parameters from that help because the options don't need either one of them. I looked at the other helpers he had in here as an example to make the options one.
With those helpers, I can get a dropdown menu to appear on the page. I've just been spinning my wheels on how to get the value from the <select></select> to appear in the resulting email.
Do you have a form around it? If there is no form, no values will be posted back.
If you work with your own surface controller, then you should have an appropriate method for the postback.
Yes, the form itself works, as in I can get an email from it. Name, email, message fields all go through. I'm puzzled on a dropdown list because this form provided only fields for a name, email, and message as defaults. Adding more text fields is easy. Adding different types of fields, i.e. checkbox, dropdown list, radio fields is more difficult.
I'm not quite sure how to build the dropdown list into what's already going on with this file. But I am trying.
I'm not sure about how your code looks like now, but shouldn't you reference the postback value using the id instead of the class name?
Anyway I always use a target (string) and a source model property (list) and then I'm rendering the dropdownlist using razor as the following:
@Html.DropDownListFor(m => m.Target, Model.Sources)
Andreas, thanks for the help. @Hmtl.DropDownListFor is throwing me an excpetion.
'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'DropDownListFor' and no extension method 'DropDownListFor' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper' could be found (are you missing a using directive or an assembly reference?) at System.Web.Compilation.AssemblyBuilder.Compile()'
I've googled it and haven't really had any luck with it. I'm not giving up though. It's something I'd like to figure out.
is working on a reply...