Checkbox Required

This is a discussion on "Checkbox Required" within the Starting Out section. This forum, and the thread "Checkbox Required are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Starting Out

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 6th, 2008, 00:10
Junior Member
Join Date: Sep 2006
Location: Here
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Checkbox Required

On my shopping when the user is required to create an account I wish to have a checkbox on that page with my terms and conditions. If this checkbox is not checked the submit button to continue would not be clickable.

How can this be achieved?
Reply With Quote

  #2 (permalink)  
Old Jan 6th, 2008, 00:36
saltedm8's Avatar
Lead Administrator

SuperMember
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,298
Blog Entries: 1
Thanks: 1
Thanked 6 Times in 6 Posts
Re: Checkbox Required

i would use javascript, like this

HTML: Select all
<script>
var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}

</script>
  <p>&nbsp;</p>
  <p align="center">Before you continue, please read the terms and conditions below</p>
  <div align="center"></div>
  <form name="agreeform" action="youraction.html" onSubmit="return defaultagree(this)">
    <div align="center">
      <div align="center">
        <textarea name="textarea" id="textarea" cols="60" rows="4">This is where you would put your text</textarea>
      </div>
      <br>
      <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)">
      <b>I agree to the above terms</b><br>
      <input type="Submit" value="Agree to these terms" disabled>
    </div>
  </form>

<script>
//change two names below to your form's names
document.forms.agreeform.agreecheck.checked=false
</script>
__________________
My Recipe forum...don't click here
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
delete by checkbox FlashO Classic ASP 3 Mar 30th, 2008 08:42
A Solved Checkbox snow Webforumz Suggestions and Feedback 14 Sep 25th, 2007 20:11
I need to make a checkbox a required field vandiermen JavaScript Forum 3 Apr 7th, 2007 19:13
Checkbox + databse rafi Classic ASP 4 Aug 4th, 2005 08:02
Unselecting a Checkbox malambing57 Classic ASP 2 Mar 10th, 2005 08:01


All times are GMT. The time now is 18:45.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43