I have a form with a few hidden fields in it. I want to populate the values from the form.cshtml page when it is loaded. What is the best way of doing this?
I see that I can't set the FieldViewModel.Value as it is read only, so is there another way of doing this?
I think I can do it by finding the values in the FieldType.HiddenField.cshtml files, but that means having to retrieve my values multiple times as I am using them on my parent page as well and it seems a bit wasteful. Is there an easy way of just passing the values in?
So you want to get a value from a property on your page into Contour as a hidden field? If that's right, you can use this syntax as the field default value:
[#propertyAlias]
You can do other thing like use cookies or querystring values in your form fields too - see page 21 of Contour Docs.
setting Field value from razor form page
Hi Guys,
I have a form with a few hidden fields in it. I want to populate the values from the form.cshtml page when it is loaded. What is the best way of doing this?
I see that I can't set the FieldViewModel.Value as it is read only, so is there another way of doing this?
I think I can do it by finding the values in the FieldType.HiddenField.cshtml files, but that means having to retrieve my values multiple times as I am using them on my parent page as well and it seems a bit wasteful. Is there an easy way of just passing the values in?
Hopefully a simple one :-)
Thanks,
Mark
Hi Mark,
So you want to get a value from a property on your page into Contour as a hidden field? If that's right, you can use this syntax as the field default value:
You can do other thing like use cookies or querystring values in your form fields too - see page 21 of Contour Docs.
Hope this helps...
is working on a reply...