• 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: show / hide multiple fields?

show / hide multiple fields? 16 years 5 months ago #5565

  • nyree
  • nyree's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
Hi
I have successfully used the tutorial to show hide SINGLE fields, but I can't work out how to hide show MULTIPLE fields from the same radio button
this is the script I am using:

if(document.getElementsByName('form[Radio]')[0].checked)
document.getElementById('hrs1').style.display=\"none\";

if(document.getElementsByName('form[Radio]')[1].checked)
document.getElementById('hrs1').style.display=\"\";

Does anyone have any suggestions??

Many thanks
Nyree:(
The administrator has disabled public write access.

Re:show / hide multiple fields? 16 years 5 months ago #5566

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
Hello,

It's simple - use this for multiple fields:
if(document.getElementsByName('form[Radio]')[0].checked)
{
document.getElementById('hrs1').style.display=\"none\";
document.getElementById('hrs2').style.display=\"none\";
document.getElementById('hrs3').style.display=\"none\";
document.getElementById('hrsn').style.display=\"none\";
}
 
if(document.getElementsByName('form[Radio]')[1].checked)
{
document.getElementById('hrs1').style.display=\"\";
document.getElementById('hrs2').style.display=\"\";
document.getElementById('hrs3').style.display=\"\";
document.getElementById('hrsn').style.display=\"\";
}

You can use as many fields as you want. Just remember to write the name of the field in the getElementById function.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.
The following user(s) said Thank You: dasaing
  • 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!