I am using the jQuery.validation plugin to validate a form. There is an optional field on the form called 'survey_url'. If this field is blank I don't want it validated, however if there is a value I want to make sure it is a valid URL.
I have the following rules, but despite the fact I have not set survey_url to 'required', it is flagged as an invalid URL even when it has no value:
  //form validation rules
  form.validate({
      errorClass: "help-inline",
      rules: {
          "webcast[title]": "required",
          "webcast[survey_url]":
          {
            url: true
          }
      },
      messages: {
          "webcast[title]": 
          {
              required: "Please enter a title for this Webcast."
          },
          "webcast[survey_url]": 
          {
              required:"You must enter a valid URL, or leave blank."
          }
      },
      submitHandler: function(form) {
          form.submit();
      }
  });
What should my rules look like so that survey_url is only validated as a URL if it has a value?
 
     
     
    