boss said:
I am trying to set a hidden form value.
When the value contains ' the page is giving some unwanted results.
Please let me know, how to handle this
Html code for your reference:
<input type='hidden' name='hiddenValue' vaule='that's it'/>
This time the fragment is sufficient for analysis, though not for solving
other problems (like "is it really a good idea to use hidden fields in your
case?"). The URL would still have been useful. For example, it often happens
that when you type or copy HTML markup into a message, some nasty software
transmogrifies it so that it isn't exactly the original.
Actually, the attribute name vaule is misspelled in your snippet. Your
actual page probably contains the correct spelling, value.
The problem is that the apostrophe ' is not allowed inside the quoted
attribute value when the apostrophe is used for quoting the string, as a
delimiter. You can avoid the problem in several ways, e.g. using quotation
mark as delimiter:
value="that's it"
or using a character reference,
value='that's it'
or maybe the typographically correct curly apostrophe (assuming you really
want to include the natural-language expression you gave as example), either
as such (I won't try it here because Usenet is not safe for non-ASCII,
though the web mostly is, properly used) or as a character reference:
value='that’s it'