Forums

disable first choice when I have no data. Help please

jprex03 08 Apr, 2012
I congratulate him on his book to buy, sorry for my English, Help, please I am beginner of ChronoForms and javascript, I'm doing a form of calls where the first part if you have no data (hung, wrong) desabilite the form. If the second part (human resources) to block only the first part (no data) but does not work


Here is the code

<div class="ccms_form_element cfdiv_radio" id="autoID-5616d8102c6488fd7d8d000698b51ab8_container_div">


<html>
<script type="text/javascript">
function disableCheck(field, causer) {
if (causer.checked) {
field.checked = false;
field.disabled = true;
}
else {
field.disabled = false;
}
}

function disableOthers(field) {
disableCheck(formulario.RH, field);
disableCheck(formulario.prospectus, field);
}

function disableUno() {
field = formulario.nodata

if (formulario.RH.checked || formulario.prospectus.checked) {
field.checked = false;
field.disabled = true;
}
else {
field.disabled = false;
}
}
</script>
<body>
<p>
  <label>No data call</label>
  <input type="hidden" name="nodata" value="" alt="ghost" />
</p>
<p>  </p>
<div style="float:left; clear:none;"><input type="radio" name="nodata" id="nodata_test" title="" value="test" class="" "disableOthers(this) />
<label for="nodata_test">test call</label>
<input type="radio" name="nodata" id="nodata_hung" title="" value="hung" class="" "disableOthers(this)/>
<label for="nodata_hung">hung</label>
<input type="radio" name="nodata" id="nodata_wrong" title="" value="wrong" class="" "disableOthers(this) />
<label for="nodata_wrong">wrong number<br>
  <br>
  <br>
  <br>
</label>
</div><div class="clear"></div><div id="error-message-nodata"></div></div><div class="ccms_form_element cfdiv_radio" id="autoID-5f603d52a9be0343eb5af5bf08f9091f_container_div"><label><br>
    <br>
    <br>
    <br>
    <br>
  RH</label><input type="hidden" name="RH" value="" alt="ghost" />
<div style="float:left; clear:none;"><input type="radio" name="RH" id="rh_inf" title="" value="INF" class="" 
onClick="disableUno()" />
<label for="rh_inf">report</label>
<input type="radio" name="RH" id="rh_que" title="" value="Que" class="" onClick="disableUno()"/>
<label for="rh_que">complaint</label>
</div><div class="clear"></div><div id="error-message-RH"></div></div><div class="ccms_form_element cfdiv_checkbox" id="autoID-73348d574ed5ba569d0fda3fea9f2dd4_container_div">
<p>
  <input type="hidden" name="prospectus" value="" alt="ghost" />
  </p>
<p> </p>
<p>
  <input value="1" title="" type="checkbox" name="prospectus" id="prospectus" class="label_left" onClick="disableUno()" />
  <label for="prospectus">prospectus</label>
</p>
<div class="clear"></div><div id="error-message-prospectus"></div></div><div class="ccms_form_element cfdiv_textarea" id="autoID-e39e62a8c4f16e9e9e1aba4f46861826_container_div">
<p>
  <label>name</label>
  <textarea cols="" rows="" class="" title="" name="name"></textarea>
</p>
<p>  </p>
<div class="clear"></div><div id="error-message-name"></div></div><div class="ccms_form_element cfdiv_submit" id="autoID-0b99c88e6074b9f6b37a5b8300912a91_container_div"><input name="submit" class="" value="submit" type="submit" />
<div class="clear"></div><div id="error-message-submit"></div></div>

</body>
</html>
GreyHead 09 Apr, 2012
Hi jprex03,

I took a look at this but I can't follow the logic of what you are trying to do :-(

Bob
jprex03 10 Apr, 2012
Thanks for responding, Bob

Excuse for my English, I'm making a form for a call center where I work, and people who receive the call, the classified.
A. - Call no data (called hanging, wrong number or a test call). desabilite number is required that all other fields.

2.-But if the person called to ask for work (human resources) can have two options a complaint or reports, and you have to enable the name of the person speaking. And disable data calls.

3.-if a person is a prospect that wants to hire services, you need to be enabled, the name and desabilite the data call.

The problem that make the fields in ChronoForms 4 in joomla 2.5, but I can not disable the fields when the option is option 1 disable all, when option 2 and 3 disable option 1.

Thanks again for your answer.
Max_admin 11 Apr, 2012
Hi jprex,

Your code formatting/structure is completely wrong, please clean it (or better re use the code generated by the wizard), give your dropdown a "field ID" and use a function like the one below in a "Load JS" action:


$('field_ID').addEvent('change', function(){
//your code here, disable/enable options
});


cheers,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
jprex03 12 Apr, 2012
Thank you very much for your answer, could you please help me with an example of how desabiltar the button, I'm new and I am very confused.

Thank you again.
Max_admin 12 Apr, 2012
Hi,

If your element has an id then do this:

$('id_here').set('disabled', true);
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
jprex03 13 Apr, 2012
Thank you very much for the support
This topic is locked and no more replies can be posted.