View Full Version : Default value for <input> changes!
CGameProgrammer
03-03-2003, 06:36 PM
I have a form with a hidden input like this:
<input type=hidden name=PostID value=80>
(for example.) However I find that sometimes, about 2% of the time, when I submit the form and read the value of that input in script, it's a null string when it should be "80". And nothing changes the value. I have no idea why this can happen. Any ideas?
vickers_bits
03-04-2003, 04:36 AM
you should always quote your attribute values
(and name has been replaced by id in xhtml)
<input type="hidden" id="PostID" value="80" />
CGameProgrammer
03-04-2003, 08:20 AM
Well that has nothing to do with the error, and I cannot use ID because there are many of these inputs. My website lists a bunch of posts, each with their own comment thread and post-comment form. The form has this hidden input to tell the upload script what post the comment is in reply to.
joh6nn
03-04-2003, 08:55 AM
actually, it wouldn't surprise me too much if the missing quotes were the problem. the web can be a harsh mistress, and fickle.
and just to clarify, name has only been deprecated, when it's NOT being used with forms. not only is name still valid with forms, it's the ONLY way to pass information from a form to the server.
SilverSurfer
03-04-2003, 09:40 AM
Yup, it's almost certainly the quotes - without those you'll get exactly what you described (not always, but often enough for it to be a pain)...
CGameProgrammer
03-04-2003, 12:30 PM
Oh, OK. I added quotes now. It's weird that that caused a problem, but it's also a relief that it's so simple to fix.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.