Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 11-08-2009
Member
 
Join Date: Feb 2009
Posts: 69
How to enable javascript if checkbox selected

I have inserted some 2 or 3 check boxes in to my web application when I wanted to set the validation on each check box, the check box should give the portability that once any one of check box has been selected the other two options should get checked automatically, Is it possible to enable with my application.
Reply With Quote
  #2  
Old 11-08-2009
Member
 
Join Date: Jan 2009
Posts: 143
Re: How to enable javascript if checkbox selected

Checkboxes are a great way to get directed input from people using your site. Sometimes you may want to limit the amount of checkboxes that can be selected at any one time. This may come in handy during form validation.
Code:
function CheckNewRequest() {
   var boolIsChecked = w.indefinite.checked;
   if (w.disksize.options[w.disksize.selectedIndex].value.length < 1) {
          alert("Please select the Disk Size you are requesting to use");
          w.disksize.focus();
          return false;
   }
Reply With Quote
  #3  
Old 11-08-2009
Member
 
Join Date: Oct 2008
Posts: 107
Re: How to enable javascript if checkbox selected

A check box has a checked property, which returns either a 0 for not checked and a 1 for checked. You can also set the property to 0 or 1 to programmatically control the check box. A simple loop checks each checkbox value for input, tallies up a count that were selected, and a couple of simple tautologies will display an appropriate message depending on the input.
Reply With Quote
  #4  
Old 11-08-2009
Member
 
Join Date: Jan 2009
Posts: 96
Re: How to enable javascript if checkbox selected

The HTML INPUT tag, with "checkbox" as the value of the TYPE attribute. For a given form, the JavaScript runtime engine creates appropriate Checkbox objects and puts these objects in the elements array of the corresponding Form object.
Code:
function checkCheckBoxes() {
	if (document.frmTest.CHKBOX_1.checked == false &&
	    document.frmTest.CHKBOX_2.checked == false &&
	    document.frmTest.CHKBOX_3.checked == false)
		{
		alert ('You didn\'t choose any of the checkboxes!');
		return false;
		}
	else
		{
		return true;
		}
	}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to enable javascript if checkbox selected"
Thread Thread Starter Forum Replies Last Post
How to enable javascript in IE8 roshan45 Technology & Internet 4 26-10-2009 08:23 PM
Enable Android Javascript Mind It Software Development 2 21-09-2009 03:07 PM
How to enable Javascript in PHP Rebella Software Development 3 12-05-2009 11:52 PM
i need to enable javascript ben4147 Windows Update 10 06-05-2008 09:15 PM
Where is in IE 7 enable/disable javascript? Jack Vista Help 3 06-04-2007 06:14 AM


All times are GMT +5.5. The time now is 04:37 PM.