'Whay can't I nclude a link in a hidden field?
Why can't I include a URL in a hidden input field? I need to so I can clone a db record from one form into a new record. Is it not possible to have a link in a hidden input field?
I populate the form from a db search and enter the found items into the "value" of hidden fields. This is my form sample:
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<input type="hidden" id="custId" name="custId" value="<a target="_blank" href="http://www.rkheadshots.com">RK Headshots</a>">
<input type="submit" value="Submit">
</form>
The only time I have an issue is if there is a link in the tect being placed into a hidden field.
You can see from that sample hidden field that RK Shots" /> will be visible. Happens to similar areas if there is a link in the value I'm trying to place into a hidden field.
Thoughts?
Solution 1:[1]
The non-escaped double-quotes are a problem. You could use single quotes (simplest option) like...
<input type="hidden" id="custId" name="custId" value='<a target="_blank" href="http://www.rkheadshots.com">RK Headshots</a>'>
Or, escape the double-quotes like...
<input type="hidden" id="custId" name="custId" value="<a target="_blank" href="http://www.rkheadshots.com">RK Headshots</a>">
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kevin |
