We can definitely talk about ways to make that happen (I have three solutions in mind). However, I'm curious about your use case. For everything I've built Formulate for so far, I've been able to avoid using hidden input field elements.
When I need to use a static bit of text, I use the "Text Constant" field type. When I need to generate a field value (e.g., when combining multiple fields into a single field), I use the "Hidden" field type and set the value on the server side. When I need to get something from the client side, I have so far only needed to set a cookie (that I then transfer to hidden field values on the server side).
Could you explain a bit about your use case so that I can be sure to offer better guidance?
thank you for your concern.
I developed a simple website that has a page with a list of products (www.mywebsite.com/products) . Every product has a link to a detail page (www.mywebsite.com/products/detail/id/1234) whose content is dynamic and is based on the product properties. That detail page has a form, created using Formulate, so the customer can use that form to ask for further detail. I would like to send the product Id (or better, the product name) as a field of the email just to know the name of the product for which the customer has requested information. I need to generate a hidden field with the product name as a value:
It sounds like what you want is a hidden field, but you need not set it on the client side. You can set it on the server side with a Formulate submitting event. You can subscribe to it like this (e.g., from an ApplicationStarting event in a class that inherits from ApplicationEventHandler):
Then you can set the value of the hidden field in that event handler:
/// <summary>
/// Handles the form submitting event.
/// </summary>
private static void FormSubmitting(FormSubmissionContext context)
{
// Set hidden field value in here.
}
No code generate by hidden field
Hi,
I checked that no HTML code is generated by the hidden field: I expect to see something like:
I would like to set an hidden field via Javascript and use it as a field on the email template So the question is. How can I use the Formulate hidden?
Thanks.
We can definitely talk about ways to make that happen (I have three solutions in mind). However, I'm curious about your use case. For everything I've built Formulate for so far, I've been able to avoid using hidden input field elements.
When I need to use a static bit of text, I use the "Text Constant" field type. When I need to generate a field value (e.g., when combining multiple fields into a single field), I use the "Hidden" field type and set the value on the server side. When I need to get something from the client side, I have so far only needed to set a cookie (that I then transfer to hidden field values on the server side).
Could you explain a bit about your use case so that I can be sure to offer better guidance?
Hi Nicholas,
thank you for your concern. I developed a simple website that has a page with a list of products (www.mywebsite.com/products) . Every product has a link to a detail page (www.mywebsite.com/products/detail/id/1234) whose content is dynamic and is based on the product properties. That detail page has a form, created using Formulate, so the customer can use that form to ask for further detail. I would like to send the product Id (or better, the product name) as a field of the email just to know the name of the product for which the customer has requested information. I need to generate a hidden field with the product name as a value:
This is my use case. Do you think that is possible to do with Formulate?
Thanks.
It sounds like what you want is a hidden field, but you need not set it on the client side. You can set it on the server side with a Formulate submitting event. You can subscribe to it like this (e.g., from an
ApplicationStarting
event in a class that inherits fromApplicationEventHandler
):Then you can set the value of the hidden field in that event handler:
Does that sound workable to you?
is working on a reply...