Extending #Episerver.forms with URL QueryString/post Value Element

How to extend Episerver Forms with a hidden QueryString/HttpPost Value Element.

Warning: A non-numeric value encountered in /storage/content/29/141529/devblog.gosso.se/public_html/wp-content/plugins/voting/themes/flat/index.php on line 27

Published 22nd of May 2017
For Episerver Version 10 and Forms > 4.4

Security warning! Be aware of how you use url parameters. This may be a security risk. Use at own risk or not at all.

Had a case where I needed to save a PageId into a form, similar to an order functionality.

You need an Element model:

And the view (which is a copy of built in PredefinedHiddenElementBlock.ascx)

Save your view under views/shared/elementblocks/

When using the element, just fill in the “Predefined value” with the key used by Querystring or form post.

It pops up in the form elements pane:

And in onpage edit:

In email placeholder you’ll find #OrderId#:

Use it wizely with httpGet or HttpPost

More reading

SEO terms:

  • Hidden post value in element of Episerver Form
  • How to extend episerver forms with querystring value
Like it? please up vote

1 thought on “Extending #Episerver.forms with URL QueryString/post Value Element”

  1. Excellent work on this, thank you. I’m only caught up on one part.The condition for Model.GetDefaultValue() throws a null error on submit (even though the form email is sent).

Leave a Reply

Your email address will not be published. Required fields are marked *