Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8596641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:43:38+00:00 2026-06-12T00:43:38+00:00

I am using the jQuery.validation plugin to validate a form. There is an optional

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:43:40+00:00Added an answer on June 12, 2026 at 12:43 am

    There must be something else going on in your script, because with what you’ve given, it works as expected: http://jsfiddle.net/ryleyb/ztDwh/1/

    You should be able to submit that form with just the title filled, and nothing in the URL. If you put in a URL, it must be in a correct URL format. Sounds like what you want?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this jQuery validation plugin and getting the famous: $(#Form).validate is not a
I'm try to validate form using jquery validation plugin my from code: source code
I'm using the Jquery Validation plugin to validate my form on the client before
So I'm using jQuery and the validation plugin to validate form input on the
i'm using jQuery validate() plugin to validate a form. it does the validation but
I'm using jQuery with the validation plugin when I submit a form: $('.frmProject:visible').validate( {
I am using the jQuery Validation plugin to validate a signup form for my
I'm using jQuery validation plugin to validate a form. when one thing is selected
I have a form that is using jQuery Validate plugin for client side validation,
When using the jQuery validation plugin (http://docs.jquery.com/Plugins/Validation/validate): I want the following behavior: Validate as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.