Form validation help

Form validation help

Hi,

I have a form with two fields. I need to validate the first field (embarkation_port) by considering the value of second field (embarkation_region_id).

It works fine for the first time but when I changed the value of second field (embarkation_region_id), how can I execute the validation again ?


What I understand is, if the first field shows an error then it doesn't validated until its value changed. How can I disable the error of a specific field ?


The script is:

<script type="text/javascript">
$().ready(function() {
 
   // validate form on keyup and submit
   $("#editembport").validate({

      rules: {
              embarkation_port: {
                 required: true,
              remote:    {
                       url: "validate_embarkation_port.php",
                     type: "post",
                     data:   {
                              embarkation_port: function()
                              {
                                 return $("#embarkation_port").val();
                              },
                              embarkation_region_id: function()
                              {
                                 return $("#embarkation_region_id").val();
                              }                              
                           }
             
                       }
               }      
          },
         messages: {
               embarkation_port: {
                  required: "Please enter Embarkation Port",
                  remote: "Embarkation Region-Port combination exists already"
               }
         }
      
   });
   
   
   // check if confirm password is still valid after password changed
   $("#embarkation_region_id").click(function() {
         $("#embarkation_port").valid();
   });
   
   
});
</script>