Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Need help with javascript validation



3:46 am on Mar 6, 2013 (gmt 0)

10+ Year Member

Hello, I am having some problems getting a checkbox for terms acceptance to work.

<form name="theForm" method="post" action="updateitem.asp" onsubmit="return validate(theForm);">

Form Stuff

  <table border="0" cellpadding="3" cellspacing="0" width="98%" class=fn10>
<td align=left><input type="submit" value="Update Quantity / Shipping" class="fn10">
<td align=right><input type="button" value="Continue to Checkout >>" onclick="window.location.href='getaddr.asp';" class=fn10></td>

What I want is a checkbox for "I accept the terms"

Note that there is a submit button that will cause an update of the data. The Button for continue is the one that will go to the next page.

Ideally, I would like the checkbox to remain if they click the checkbox and then the update/submit.

I'd really appreciate any guidance. I hit a mental block on this and couldn't get it after a couple of hours.




4:16 pm on Mar 6, 2013 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Something like that you should be storing server side. That is, if the user needs to agree to some terms/conditions, that agreement should be something that's saved in your database, which means you'd control the checked state of it depending on what was in the database.

If you don't want to do it that way, and you only want to add client side validation (I strongly recommend against doing it this way), then you could have a checkbox and control the checked state based on some session cookie. The has several problems though:
1. What if the user has JavaScript disabled?
2. There are probably ways around "agreeing" to the terms.
3. You won't have any stored proof that they ever agreed to any particular terms.

Featured Threads

Hot Threads This Week

Hot Threads This Month