If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Form checking ... again!!

Hi,

I have read many many posts on form checking with javascript, but I just can't seem to work out what I need. I don't know much about javascript at all. Most of my site is using php.

My problem:- I have a form that posts to another page when submitted. Now I need to add in a checkbox on the form. If the checkbox is ticked the form can be submitted to the next page, but if it is not ticked I want to have a warning popup with Yes No buttons on it. If they click Yes it will post to the next page, if they click No the form will not post, allowing them to either tick the box or make other changes.

Thanks so much Ess, I haven't tested it with my full form as yet to make sure all the information is posted to the next page (I don't see why it wouldn't), but changing the method="post" and action="next.php" it works perfectly.

I tried so many other examples before posting, it seems simple once I have been shown it. Much appreciated.

I have started to put the code into my page and have just realised that I have more than one submit button. I only want it to check for the checkbox when one of the buttons is clicked, not the other. How can I work out which button was clicked?

EDIT:- Nevermind, using my usual coding method (trial and error) I finally worked out how to move the javascript call into the button itself.