PDA

View Full Version : OnSubmit "I Agree" open a registration form



gerhardtj
01-24-2007, 03:50 PM
I am looking for or need help with a JavaScript that will do the following:

When an applicant checks the "I agree" check box for a membership agreement, the script validates that the box was checked and then automatically opens in the same windown a membership application form that the applicant completes and submits.

I need this asap.

Thanks,

gerhardtj

Twey
01-24-2007, 04:01 PM
It's better to have the "I Agree" checkbox as part of the form, validated by the same server-side script that validates the application.

ddadmin
01-24-2007, 09:32 PM
Check out Agree Terms script (http://www.dynamicdrive.com/dynamicindex16/acceptterm.htm), though as Twey said, only a server side script can ensure the user has checked the box, as if JavaScript is disabled, the script I mentioned would be bypassed.

Twey
01-24-2007, 09:53 PM
Bypassing aside, there's simply no point doing client-side checking of data when you're going to do server-side validation anyway.

gerhardtj
01-29-2007, 04:53 PM
Bypassing aside, there's simply no point doing client-side checking of data when you're going to do server-side validation anyway.
Thanks for your feedback. I agree that server-side validation is the way to go. I am using a php email form to collect applicant data. I imagine the server side "I agree script" that would open a second application form when checked (validation) could be done in php?

Any suggestions? Scripts? I am working on a php 5.0/MySql Linux OS Apache web server.

Thanks, again.

Gerhardt

Twey
01-29-2007, 05:45 PM
Why? Just stick a checkbox at the bottom of your form:
<label>
<input type="checkbox" value="yes" name="tos">
I agree with the <a href="tos.html">terms and conditions</a>.
</label>... and modify the PHP script a little.

mburt
01-29-2007, 06:13 PM
continuation...

if (isset($_POST["tos"])) {
//enter exisisting code here
}

and set the form method to "post" and action to the file above.

Twey
01-29-2007, 06:51 PM
You might want an else clause there to display an error message, too.