Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Mark 122 posts 255 karma points
    Jul 23, 2014 @ 10:54

    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 :-)



  • Dan 1279 posts 3891 karma points c-trib
    Jul 23, 2014 @ 11:51

    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...

Please Sign in or register to post replies

Write your reply to: