Forums

Hideable section doesn't work

laurentmartin 27 Jun, 2011
Hi ,

I have downloaded and implemented the file to hide section with javascript

I have some difficulties with radio button .
Typically one radio button already cheked NO and another radiobutton that display a textfield when YES is checked.

Here is the code i have in my page


<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label" style="width: 250px;">Do you want ?</label>
    <div class="float_left">
      <input value="No" title="" class="check_label" id="radio00" name="radio0" type="radio" checked />
      <label for="radio00" class="radio_label">No</label>
      <br />
      
<input value="Yes" title="" class="check_label" id="radio01" name="radio0" type="radio" rel="othercountry"/>
      <label for="radio01" class="radio_label">Yes</label>
      <br />
      

    </div>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item" rel="othercountry">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 250px;">Who is it ?</label>
    <input class="cf_inputbox validate-email" maxlength="150" size="30" title="" id="text_30" name="who_is_it" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>


I have included the PHP line provided in the example:
<?php
$doc =& JFactory::getDocument();
$doc->addScript('components/com_chronocontact/includes/js/usable_forms.js');
$doc->addScript('components/com_chronocontact/includes/js/validation.js');
?>


Any idea why it doesn't work ?
GreyHead 27 Jun, 2011
Hi laurentmartin,

I think you need to add rel='none' to the 'No' input

To get this to work there is one more important step. The ‘Single’ radio button has no ‘rel’ attribute. To let the script work each input in the group must have a ‘rel’ attribute so we’ll add rel="none".


Bob
laurentmartin 27 Jun, 2011
I added it with " and it works like a charm.

Thanks a lot
This topic is locked and no more replies can be posted.