Welcome to WebmasterWorld Guest from 54.167.86.211

Forum Moderators: open

Message Too Old, No Replies

Need help with javascript validation

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

Preferred Member from US 

10+ Year Member

joined:May 6, 2004
posts: 650
votes: 0


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>
<tr>
<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>
</tr>
</table>
</p>



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.

Thanks

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

Senior Member from US 

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

joined:Oct 17, 2005
posts: 4966
votes: 10


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.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members