Note that there are some explanatory texts on larger screens.

plurals
  1. PORadio Button Validation u
    text
    copied!<p>I am trying validate the radio button using Javascript . But I couldn't get it. Can any one please help me to fix this Issue. I Have attached My Code Below. Thanks.</p> <pre><code>&lt;form action="submitAd.php" method="POST" enctype="multipart/form-data" name="packages" onsubmit="return checkForm()"&gt; &lt;div id="plans_pay"&gt; &lt;input type="radio" name="group1" id="r1" value="Office" onchange="click_Pay_Office()" style="float:left;margin-top:20px;font-size:72px;"&gt; &lt;label style="float:left; margin-top:20px;" for="pay_office"&gt;At Our Office&lt;/label&gt; &lt;img style="float:left;margin-bottom:10px;" src="images/Pay-at-office.png" /&gt; &lt;/div&gt; &lt;div id="plans_pay"&gt; &lt;input style="float:left;margin-top:20px;font-size:72px;" type="radio" name="group1" id="r2" value="HNB" onchange="click_Pay_Hnb()"&gt; &lt;label style="float:left; margin-top:20px;" for="pay_hnb"&gt;At Any HNB Branch&lt;/label&gt; &lt;img style="float:left;margin-bottom:10px;" src="images/HNB.png" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p><strong>Javascript</strong></p> <pre><code>function checkForm(){ if( document.packages.pso.checked == false &amp;&amp; document.packages.pso1.checked == false &amp;&amp; document.packages.ph.checked == false &amp;&amp; document.packages.ph2.checked == false &amp;&amp; document.packages.ph3.checked == false &amp;&amp; document.packages.pl.checked == false &amp;&amp; document.packages.p3.checked == false &amp;&amp; document.packages.p4.checked == false &amp;&amp; document.packages.p5.checked == false &amp;&amp; document.packages.p6.checked == false ){ alert('Please Select At Least One Package'); return false; } if( document.packages.pso.checked == false &amp;&amp; document.packages.pso1.checked == false &amp;&amp; document.packages.ph.checked == false &amp;&amp; document.packages.ph.checked == false &amp;&amp; document.packages.ph2.checked == false &amp;&amp; document.packages.ph3.checked == false &amp;&amp; document.packages.pl.checked == false &amp;&amp; document.packages.p3.checked == false &amp;&amp; document.packages.p4.checked == false &amp;&amp; document.packages.p5.checked == false &amp;&amp; document.packages.p6.checked == false){ alert('Please Select At Least One with the Advertise online option in premium package'); return false; } if(document.getElementById('words').value==''){ alert("Please Enter the Texts"); return false; } if(document.getElementById('r1').checked==false &amp;&amp; document.getElementById('r2').checked==false){ alert("Please Select a Payment Method"); return false; } } </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