Preserved Topic: Using PHP to generate Javascripts (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: New Jersey, USA |
posted 12-30-2001 20:10
I am using a PHP script to take a user defined number and generate a form based on that user input. The form fields are set up as an array, i.e.: |
Bipolar (III) Inmate From: the space between us |
posted 12-30-2001 20:55
kinda similar problem here: |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 12-30-2001 21:11
the problem here is probably that when you do the validation the date[1] is seen as a javascript array. |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 12-30-2001 21:21
Thanks Grumble |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 12-30-2001 21:33
You're trying to assign these form elements to an array just by giving them names that look like javascript code. You can't do that. When the browser sees date[0], it's looking for an object called "date" that's an array, and then it looks for the first element of that array. But you haven't made an object called "date". |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 12-30-2001 22:02
Butcher, modify testAndSubmit() function to look like this: |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 12-30-2001 22:11
Thanks Slime |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 12-30-2001 22:13
Thanks mr.maX |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 12-31-2001 00:22
Ah, I didn't realize the PHP required that. Yup, Max's code works because by using the object["property"] syntax, it keeps the browser from looking at date[0] and thinking it's an array in itself. |