0

I have the following:

  • table rows containing radio buttons
  • a link named "Issue" that gives a pop up with 1 submit button
  • a submit button named "details" that gives a popup

My problem is:

1.) If I click on the link without selecting the radio buttons, I am not getting "required"msg for my radio button instead pop up appears directly.And now if I click on "yes" It shows "radio button required".

2.)I am facing same problem On clicking details button directly without selecting radio button also.

My radio button is:

<input type="radio" name="ID[]" value="<?php echo $total; ?>" id="inc_untraced"<?php echo $_POST['ID'][0]==$total ? 'checked':'';?> required />

1.) My code for link popup:

<a href="#modalDialog1" id="btn">
                        Issue Notice</a>
<div id="modalDialog1" class="modalDialog">
<div>
<table id="pop">
<tr>
<td>Would you like to issue Notice?</td>
</tr>
<tr>
<td ><input type="submit" name="details" value="Yes" id="btnYES" formaction="notice.php" /></td>
</tr>
</table>
<a href="#close" title="Close" class="close">X</a>                  
</div>
</div>

2.) My code for pop up using button:

<input type="submit" name="details" value="Details" id="btndetails"   />
<div id="element_to_pop_up">
                </div> 

Jquery:

(function($) 
{
    $(function() 
    {

        $('#btndetails').bind('click', function(e) {
        // Prevents the default action to be triggered. 
        e.preventDefault();
         var n=$('#inc_untraced:checked').val(); 
                var a=n.split("(!@!)");

                 $("#element_to_pop_up").html("Details are:a[0],a[1] .. /*some details*/");
                $('#element_to_pop_up').bPopup();
             });
      });
})(jQuery);

Can any one please help me get that "REQUIRED"msg for radio buttons when I click on LINK and BUTTON directly instead of popup?

PLZ NOTE: I DONT WANT TO USE ALERT BOX .

Please please help me!!

Lilly Shk
  • 147
  • 1
  • 21

1 Answers1

0

You can set the radio to true on unwanted button clicks, or disable the unselected row buttons and enable the only one with the checked radio. That approach would be more user friendly.

Check this out : http://jsfiddle.net/n9v4oe3a/4/

Taha Paksu
  • 15,371
  • 2
  • 44
  • 78