Note that there are some explanatory texts on larger screens.

plurals
  1. POcalling java script in radio button not working
    text
    copied!<p>i am calling a java script function on click of a radio button and based on the radio button i need to call another java script function to clear some field values. </p> <p>Problem : always entering approve function and field is not cleared </p> <p>here is a snap shot of the code please go through it and guide me where i am wrong and what can be done. </p> <pre><code>&lt;h:selectOneRadio id="selectApprovaRl1" onfocus="return setemptyrejquery(this.form)" value="#{bean.approvalCode}"&gt; &lt;f:selectItem id="selDecR1" itemLabel="Approve" itemValue="Approved" /&gt; &lt;f:selectItem id="selDecR2" itemLabel="Reject" itemValue="Rejected" /&gt; &lt;f:selectItem id="selDecR3" itemLabel="Query" itemValue="Queried" /&gt; &lt;f:selectItem id="selDecR4" itemLabel="Pending" itemValue="Pending" /&gt; &lt;a4j:support event="onclick" reRender="listPanel11,listPanel22,listPanel33,listPanel44,listPanel445" /&gt; &lt;/h:selectOneRadio&gt; </code></pre> <p>java script function</p> <pre><code>&lt;script type="text/javascript"&gt; function setemptyrejquery(f){ alert("running................."+f.name); var ex1 = document.getElementById('selDecR1'); var ex2 = document.getElementById('selDecR2'); var ex3 = document.getElementById('selDecR3'); var ex4 = document.getElementById('selDecR4'); ex1.onclick = approve(f.name); ex2.onclick = rejquery(f.name); ex3.onclick = rejquery(f.name); ex4.onclick = pending(f.name); } function approve(f) { alert("running.......approve.........."+f); var txt4=document.getElementById('textDec12').value=""; var txt5=document.getElementById('textDec2').value=""; alert("Reseted........approve"); } function rejquery(f) { alert("running.......rejquery.........."+f); var txt4=document.getElementById('textDec1').value=""; var txt5=document.getElementById('textDec22').value=""; alert("Reseted.........rejquery"); } function pending(f) { alert("running.......pending.........."+f); var txt4=document.getElementById('textDec145').value=""; var txt5=document.getElementById('textDec2245').value=""; alert("Reseted............pending"); } &lt;/script&gt; </code></pre> <p>html generated</p> <pre><code>&lt;table class="form-container" width="100%"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="col_label"&gt; &lt;span id="Form:decision"&gt; Decision &lt;span class="mandatory"&gt; * &lt;/span&gt; : &lt;/span&gt; &lt;/td&gt; &lt;td class="col_value_two"&gt; &lt;table id="Form:selectApprovaRl1"&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="radio" name="Form:selectApprovaRl1" id="Form:selectApprovaRl1:0" value="Approved" onclick="A4J.AJAX.Submit('Form:j_id724','Form',event,{'similarityGroupingId':'Form:j_id730','parameters':{'Form:j_id730':'Form:j_id730'} ,'actionUrl':'/file.jsf'} )" onfocus="return setemptyrejquery(this.form)" /&gt; &lt;label for="Form:selectApprovaRl1:0"&gt; Approve&lt;/label&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="radio" name="Form:selectApprovaRl1" id="Form:selectApprovaRl1:1" value="Rejected" onclick="A4J.AJAX.Submit('Form:j_id724','Form',event,{'similarityGroupingId':'Form:j_id730','parameters':{'Form:j_id730':'Form:j_id730'} ,'actionUrl':'/file.jsf'} )" onfocus="return setemptyrejquery(this.form)" /&gt; &lt;label for="Form:selectApprovaRl1:1"&gt; Reject &lt;/label&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="radio" name="Form:selectApprovaRl1" id="Form:selectApprovaRl1:2" value="Queried" onclick="A4J.AJAX.Submit('Form:j_id724','Form',event,{'similarityGroupingId':'Form:j_id730','parameters':{'Form:j_id730':'Form:j_id730'} ,'actionUrl':'/file.jsf'} )" onfocus="return setemptyrejquery(this.form)" /&gt; &lt;label for="Form:selectApprovaRl1:2"&gt; Query &lt;/label&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="radio" checked="checked" name="createExportImportLicenseForm:selectApprovaRl1" id="Form:selectApprovaRl1:3"value="Pending" onclick="A4J.AJAX.Submit('Form:j_id724','Form',event,{'similarityGroupingId':'Form:j_id730','parameters':{'Form:j_id730':'Form:j_id730'} ,'actionUrl':'/file.jsf'} )" onfocus="return setemptyrejquery(this.form)" /&gt; &lt;label for="Form:selectApprovaRl1:3"&gt; Pending &lt;/label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload