![]() Preserved Topic: Using PHP to generate Javascripts (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: New Jersey, USA |
![]() 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 |
![]() kinda similar problem here: |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() 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 |
![]() Thanks Grumble |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() 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 |
![]() Butcher, modify testAndSubmit() function to look like this: |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() Thanks Slime |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() Thanks mr.maX |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() 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. |