Good Morning,
I am not familiar with Javascript and have been working on creating conditional elements for a web form. We have a Joomla site and have been using RSForm Pro to create the form. The developer of the program has a tutorial on creating these types of hidden/visible fields which after a lot of trial and error I was mostly able to make work.
I basically have a radio field that triggers a set of fields to be hidden or visible. My problem is that by default, those fields are displayed and only go away when the user selects “no”. I’d like to reverse that and have the fields hidden until the user checks “yes” at which time they display.
The script I am using is below, and the {2nd Location} is the field name for the radio button. Can anyone help me with this issue?
<script type=”text/javascript”>
function displayField()
{
if(document.getElementsByName(‘form[2nd Location]’)[0].checked)
document.getElementById(‘hide’).style.display=”none”;
if(document.getElementsByName(‘form[2nd Location]’)[1].checked)
document.getElementById(‘hide’).style.display=””;
}
</script>