Javascript Validation Problem

Associate
Joined
28 Nov 2004
Posts
1,237
Location
Birmingham
Hi guys,
If you can help me out with this I'll be eternally grateful!

I have a page with a number drop down on it...the user selects a number and the form i need to validate is generated x times (with x being the number selected).

The form is basically a group of date fields.

so, if the user selects 2 in the drop down, a div on the page is populated with:

p_day1 / p_month1 / p_year1
p_day2 / p_month2 / p_year2

This all works fine and I can pass the values from the form to my database in the back end using ASP.

However, if I try and do any kind of Javascript validation on the page (before the form submits) it can't see the p_ objects above. Although they are displaying in the browser, if I view source they are not there either. I presume this is because I am dynamically generating them??

I really want to carry out validation via an AJAX/Javascript function I have but if I can't retrieve those above fields using documet.getElementById('p_day1').... etc I'm screwed!!

Any ideas!?!?
 
sist_si said:
Hi guys,
If you can help me out with this I'll be eternally grateful!

I have a page with a number drop down on it...the user selects a number and the form i need to validate is generated x times (with x being the number selected).

The form is basically a group of date fields.

so, if the user selects 2 in the drop down, a div on the page is populated with:

p_day1 / p_month1 / p_year1
p_day2 / p_month2 / p_year2

This all works fine and I can pass the values from the form to my database in the back end using ASP.

However, if I try and do any kind of Javascript validation on the page (before the form submits) it can't see the p_ objects above. Although they are displaying in the browser, if I view source they are not there either. I presume this is because I am dynamically generating them??

I really want to carry out validation via an AJAX/Javascript function I have but if I can't retrieve those above fields using documet.getElementById('p_day1').... etc I'm screwed!!

Any ideas!?!?
Could you post a direct link to your HTML & JS?
 
ok, i've here is the page (well, a cut down version with the problem outlined in the code)
http://www.thefalltherise.co.uk/bookEditSample.asp

if you select a shift count - use 1 for now - then hit submit, i am alerting the url i want to call but the day, month and year values are empty.
The problem occurs on line 46,47,48....

From what I've found on the web this is a known problem with building forms in this manner but supposedly, if you give your generated elements an 'id' it should be ok. I have and this still doesn't work!

:(
 
Back
Top Bottom