How do I create a hidden input type in a form?

I’ve been trying to figure out how to add a (input type=“hidden”) to a form in Sparkle. Any thoughts or tips?

@icecycle, Welcome onboard! :slight_smile:

If I get what you are asking then yes you can…
When you have selected your, say, name input container you’ll see on the right-hand panel below “Single Line” a tick box next to the tile “Hidden”. When selected it will show dots instead of alphanumerical when content is entered.

I was more asking about including a hidden field in a form that I could submit as part of a form when it is submitted.

< input type=“hidden” name=“name” value=“example” />

@icecycle, Mmmm… Sorry I’m not sure in how I would go about that? From what I know Sparkle doesn’t allow that for now, and I’m thinking the only way around it would be to embed a form but for me that would be messy.

If I understand you, you want to have additional text in the e-mail you receive, but not seeing on the page? If so, then just untick «Show on this device» for that field in the Arrange tab and it will send the value with the e-mail, but not showing on the page.

It’s not supported by the built-in forms. You can add a regular text input and make it hidden on all devices, it will have a similar effect even if it’s a bit of a hack. We’d like to support more use cases for the form, so can you tell me what do you need it for?

Duncan,
I’m actually thinking of trying to use a sparkle html form to integrate a simple Foxycart e-commerce button for a few products (1-2 items). One way to add product buy buttons and qtys is to create a small form with hidden elements. You can see more about it here: https://wiki.foxycart.com/v/2.0/products

I’m thinking I will try your idea of using a regular text input and make it hidden on all devices. I’m going to try that out to see if I can make that work. Using a html form would be a neat hack for using sparkle to create a small online store with a few products.

Thanks,
Wil

Adding to this request:

I am trying to add a hidden field to my form to tell the next page where to redirect after handling the form (using advanced form submission). The form field in “regular” HTML would be:

<input type="hidden" id="redirect" name="redirect" value="https://google.com">

I tried two methods in sparkle, which didn’t seem to work:

  • Create a hidden text field with the URL pre-loaded as filled content
  • Create a code snippet with the HTML noted above

Neither worked, the last one obviously couldn’t be included in the form but it was an attempt at a hack.

As you mentioned above you are looking for a way to extend the form’s functionality in Sparkle and I think hidden fields would open it up to advanced form handlers like Integromat/Zapier, which would make Sparkle way more powerful. I previously asked this in 2020 when I was trying a similar hack to pass UTMs through.

-Chris

I’m wondering once the User is directed to the Thank You (or whatever you have called it) page you created, you could insert a javascript 5 second counter redirect which then redirects the User to the page you have in mind?

Theoretically, yes, but in Sparkle’s “Advanced Form Submission” there is no Thank You page field; and, sending a POST request to Integromat simply returns an Accepted response. (Integromat requires the URL for redirection to be passed in the POST.)

The former should work except for the id, which I don’t believe is sent in forms.

I just tried and sure enough:

image

And the generated code:

Perfect! Thanks @duncan