If you look in the main CSHTML file, you'll notice initialValue is being set based on a query string. You can actually set this according to any logic you desire.
Text Constant Fields
Instead of a hidden field, you can use a text constant field. That allows you to enter the value in the Formulate section (if the value does not change).
Form Submission Event
There is an event you can hook into on the server side when the form is submitting that allows you to alter field values.
Let me know if any of these approaches sounds like it'd fit your scenario and I can give you some additional information.
If i have a formulate form with a textbox for name and then a hiddenfield
with field alias "test"
How can i then set the hiddenfield to a value. What should i write in the "SomeGuidHere" i have tried with the formulate field-id but i dont insert the value.
$scope.$on("Formulate.submit", function (event, data) {
var newData = { '3bb04875310447cc8526c06efd429799': 'Test of hidden field' };
data.postData = angular.extend({}, data.postData, newData);
});
Formulate set hidden field
Hello, i have created a form with the plugin formulate.
I now want to have a hidden field. I have created the hidden field and i can see it in my form in the html.
But it just shows the field as an div not an input.
So have can i set the value of the hidden field?
Funny you should ask. A coworker of mine just asked this and come up with something like this:
Below are some other options.
Set Initial Value
If you look in the main CSHTML file, you'll notice
initialValue
is being set based on a query string. You can actually set this according to any logic you desire.Text Constant Fields
Instead of a hidden field, you can use a text constant field. That allows you to enter the value in the Formulate section (if the value does not change).
Form Submission Event
There is an event you can hook into on the server side when the form is submitting that allows you to alter field values.
Let me know if any of these approaches sounds like it'd fit your scenario and I can give you some additional information.
Hello Nicholas,
Thanks for reply.
If i have a formulate form with a textbox for name and then a hiddenfield with field alias "test"
How can i then set the hiddenfield to a value. What should i write in the "SomeGuidHere" i have tried with the formulate field-id but i dont insert the value.
Can you help more?
Hello Nicholas,
I managed to get it to work with your code.
Thanks!
Happy to hear it :-)
is working on a reply...