PDA

View Full Version : Form Validation wont work in ajax window.


mdj101
02-21-2008, 04:48 PM
Hi All,

Im new to all this as you are probably aware!

I've come accross a stumbling block.

On the following page if you try and submit the form with empty fields you get a javascript alert.

http://www.fireworkscrazy.co.uk/store/shopreviewadd.asp?id=166

However, the same form is pulled into this page,

http://www.fireworkscrazy.co.uk/store/shopexd.asp?id=166

cliick on the "add your own review" link at the bottom of the review section. When the page loads, if you try and submit the form empty you don't get the javascript alert.

Can someone please explain why and if it can be resolved?

chud_wallice
02-22-2008, 03:16 PM
Have you tried including the validation script in the main page?

I wouldn't call the form into the page using ajax.
I'd put the form directly into the page and hide it onload.

Though you may want to add the review, and update the page on submission using ajax...

mdj101
02-22-2008, 03:26 PM
Hi Chud,

Thanks for your reply.

The form that is pulled in is part of an asp script, not just an html form and the page it pulls in does all the asp work aswell. I'm really trying to make the cart nicer to use etc, if i was re-inventing things, starting the site from scratch then i believe that alot of the suggestions that have been made would work great and I would have a lot more flexibility, im not a coding guru by any means and its where i fall short of being able to sort these little problems out.

mdj101
02-22-2008, 03:28 PM
I could like you say include the validation page in the main page, i will try that!

chud_wallice
02-23-2008, 01:31 PM
so does it work now when you put the validation script on the main page?

mdj101
02-23-2008, 03:05 PM
Had a couple of server issues so havent had a chance to try it out yet!

mdj101
02-24-2008, 05:04 AM
Hi Chud,

Just had a chance to play around with this and the javascript works perfectly when its embeded in the original page! Thanks for the suggestion.

mdj101
02-24-2008, 05:06 AM
Im now going to attempt a couple of other pages. I'm sure I will be back!