Hiding a form field

This is a follow-up to my previous post -

So, I wanted to know whether my subscribers self-subscribed through my website, or if they were manually added. So I added a multiple choice field in my form on the site that is only have one choice: "website subscribe"

The html is as follows:

<select name="cm-fo-172426"> (this particular field)
<option value="46325"> (I have only the "website subscribe" option here)

I have tested this and it is working - submissions come up with the correct data.

Now I need to hide this field! Obviously I can't put <!-- --> tags around it or it voids what is inside. What is the easiest way to hide a field? Should I float a white square on top of it? Is there an easy way around this??

I have background in CSS and HTML - it just seem after googling for tricks there has to something easier than what I've come up with...

Diana Diana, 9 years ago

Edeath, you could put a class on it  or a div around it and then just have display:none in the CSS for it.

D. Potter
Campaign Monitor
aognenoff, 9 years ago

Just make the field a hidden form field to begin with.

This should do it for you:

<input name="cm-fo-172426" type="hidden" value="46325" />

And I would change that from a multi-choice field to just a plain old text field - since you really aren't using it as a multi-choice field. Either way, the HTML is the same.

Diana Diana, 9 years ago

that works too :)

D. Potter
Campaign Monitor
aognenoff, 9 years ago

I like simple solutions. ;)

Edeath, 9 years ago

You all are the best! I know there was some incredibly obvious simple solution.

So I have

<input type="hidden" name="cm-f-172426" id="Source" value="self-subscribe" />

-the value field being the information submitted back to me - checked it out and it works. Thank you!!!

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free