• 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: Checkbox javascript problems

Checkbox javascript problems 16 years 4 months ago #6053

  • pauli
  • pauli's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
I have been following the tutorials in the RSForms manual but am having trouble using check boxes.

I have a simple single item checkbox which has additional attributes set as below:

onclick=\"displayField('classA', this);\"

However, the 'if' clause to test the check box for 'checked' doesn't work. Any ideas what may be wrong with the 'if' line below?

I know the function is being called because if I set the 3rd line to display=\"none\" the table is hidden when I click the checkbox.

<script type=\"text/javascript\">
function displayField(tableName, className)
{

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

document.getElementById(tableName).style.display=\"\";

}
</script>
The administrator has disabled public write access.

Re:Checkbox javascript problems 16 years 4 months ago #6056

  • pauli
  • pauli's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Oops sorry - the script actually looks like this

<script type=\"text/javascript\">

function displayField(tableName, className)
{
if(document.getElementsByName('form[className]')[0].checked == true)
document.getElementById(tableName).style.display=\"none\";
else
document.getElementById(tableName).style.display=\"\";
}

</script>
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!