First I would like to say that this plugin is absolutely amazing…excellent
work Jörn! 

Now on to my problem: I’ve noticed that the validation plugin doesn’t
support radio buttons with name="data[FormItem][38]" specified. It will
correctly validate the radio button group (for instance, if required=true if
will display the error label indicating the field is required if a radio
button was not clicked), however, it will not submit the form once a valid
option is chosen.

If I change the name to not use the [] array format then the submitHandler
will fire correctly. Unfortunately this is not an option for me as the []
array format is used for all CakePHP form elements. The validation plugin
handles all other form elements with this format correctly. I have added a
short test case below. Clicking submit will correctly display the error
label if an item is not chosen. Clicking a radio button and submitting the
form again will not fire the submitHandler. If you change the radio group
name to “test” then everything works as expected.

Thank you for any help you can provide.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Test for jQuery validate() plugin</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css"
/>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/cmxforms.js" type="text/javascript"></script>
<script src="js/metadata.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
      $(document).ready(function() {
            // validate the form when it is submitted
            $.validator.setDefaults({
                  debug: false,
                  focusInvalidElement: true,
                  submitHandler: function(form) {
                        alert("submit");
                  }
            });
            $("#form1").validate();

      });
</script>
</head>
<body>
<form class="cmxform" id="form1" method="get" action="">
  <fieldset>
  <legend>Validating a form with a radio and checkbox buttons</legend>
  <fieldset class="f-checkbox-wrap">
  <b><span class="req">*</span>Makes</b>
  <label for="FormItem380">
  <input type="radio" name="data[FormItem][38]" id="FormItem380"
value="Honda" class="f-radio {required:true}" />
  Honda</label>
  <label for="FormItem381">
  <input type="radio" name="data[FormItem][38]" id="FormItem381"
value="Hyundai" class="f-radio"  />
  Hyundai</label>
  <label for="FormItem382">
  <input type="radio" name="data[FormItem][38]" id="FormItem382"
value="Toyota" class="f-radio"  />
  Toyota</label>
  <label for="data[FormItem][38]" class="error">Please select your family
status.</label>
  </fieldset>
    <p>
    <input class="submit" type="submit" value="Submit"/>
  </p>
  </fieldset>
</form>
</body>
</html>

Ryan Rose
Vice President
Digiwize, Inc.
One Technology Drive
Tolland, CT 06084
e: [EMAIL PROTECTED]
p: 860.730.2631
http://www.digiwize.com



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to