adamfletcher1
03-10-2005, 04:16 AM
Hi guys.
Have a curly one!
I have a registration form that is linked to a mailing list database.
As such, many of the form fields must be in the format 'field[xx]',
i.e. 'document.Register.field[xx].value'
The trouble is validation.
I have a validation script that validates textfields, dropdowns, radiobuttons and checkboxes etc.
i.e.
if(WithoutContent(document.Register.field[27].value))
{ errormessage += "\n\nPlease enter your last name.";
}
The validation does not like the 'field[xx]' bit.
An error might read "Error ... 'document.Register.field.xx' is blah blah blah...."
I have tried making the square brackets hexadecimal etc and even tried +'['+27+']' etc.
I have even replaced the 'field[xx]' with a name like 'lastname' in the form, validated that and then made the value of 'lastname' equal to the value of a hidden field called 'field[xx]' after the validation to then pass to the db but even this doesn't work.
Does anybody have a nice javascript way around this without me having to go into PHP or some server-side function?
That would be swell....
http://intouch.fcnews.com.au/0503/subscribe.htm
Warm Regards,
Adman
Have a curly one!
I have a registration form that is linked to a mailing list database.
As such, many of the form fields must be in the format 'field[xx]',
i.e. 'document.Register.field[xx].value'
The trouble is validation.
I have a validation script that validates textfields, dropdowns, radiobuttons and checkboxes etc.
i.e.
if(WithoutContent(document.Register.field[27].value))
{ errormessage += "\n\nPlease enter your last name.";
}
The validation does not like the 'field[xx]' bit.
An error might read "Error ... 'document.Register.field.xx' is blah blah blah...."
I have tried making the square brackets hexadecimal etc and even tried +'['+27+']' etc.
I have even replaced the 'field[xx]' with a name like 'lastname' in the form, validated that and then made the value of 'lastname' equal to the value of a hidden field called 'field[xx]' after the validation to then pass to the db but even this doesn't work.
Does anybody have a nice javascript way around this without me having to go into PHP or some server-side function?
That would be swell....
http://intouch.fcnews.com.au/0503/subscribe.htm
Warm Regards,
Adman