• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: RESOLVED: help with checkbox Javascript function

RESOLVED: help with checkbox Javascript function 11 years 11 months ago #17281

  • deziner76hd
  • deziner76hd's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
Hello,
I have four check boxes. Dog, Cat, Other, None of These. If Dog Cat and Other is checked that is fine but if the check box "None of These" is checked I need it to remove the check from all other boxes.

This is an example of exactly what I need my form to do jsfiddle.net/srEuM/

Does anyone know how I can accomplish this with RS Form Pro? I have been messing with this for days and could really use some help.
Thank you
Deziner
Where there's a will there's a way
Last Edit: 11 years 11 months ago by deziner76hd. Reason: resolved
The administrator has disabled public write access.

Re: help with checkbox Javascript function 11 years 11 months ago #17284

  • deziner76hd
  • deziner76hd's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
This is the Javascript I am using right now but it isn't giving me the complete results I need.
<script type="text/javascript">
function checkI()
{
 var checkL = document.getElementsByName('form[PetsInHouse][]');
   for (var i=0;i<checkL.length-1;i++)
     if(document.getElementById('PetsInHouse3').checked){
      document.getElementById('PetsInHouse'+i).disabled = true;
      document.getElementById('PetsInHouse'+i).checked = false;
     }
     else {
      document.getElementById('PetsInHouse'+i).disabled = false;
     }
}
</script>
Where there's a will there's a way
The administrator has disabled public write access.

Re: help with checkbox Javascript function 11 years 11 months ago #17297

  • deziner76hd
  • deziner76hd's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
I have resolved the issue like this

Javascript code:
<script type="text/javascript">
function checkI()
{
var other=0;
 var checkL = document.getElementsByName('form[PetsInHouse][]');
   for (var i=0;i<checkL.length-1;i++){
     if(document.getElementById('PetsInHouse3').checked){
      document.getElementById('PetsInHouse'+i).disabled = true;
      document.getElementById('PetsInHouse'+i).checked = false;
		}
     else {
      document.getElementById('PetsInHouse'+i).disabled = false;
		}
		if(document.getElementById('PetsInHouse'+i).checked){
		other++
		}
	 }
	 document.getElementById('PetsInHouse3').disabled=other>0?true:false;
	}
</script>

And used this call in the additional attributes:
onclick="checkI();"
Where there's a will there's a way
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!