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 7961481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:03:01+00:00 2026-06-04T05:03:01+00:00

I have a form which I am validating through the jQuery Validate plugin. Everything

  • 0

I have a form which I am validating through the jQuery Validate plugin. Everything is working fine except just one thing.

I have a field that I using, the remote rule, and I am using AJAX to check if there is already an application record with the same name. I need to perform this validation only if the user changes the value in the field.

This is the validate code I have:

$('#createapp').validate({
    rules: {
      appname: {
        minlength: 8,
        required: true,
        remote: {
                url: "<?php echo base_url();?>app/application/check_app",
                type:"POST",
                async: false,
                data:  {
                appname: function() {
                return $("#appname").val();
          }
        }  
      }
      },
      apptitle: {
        required: true
      }
    },
    messages: {
        appname: {
      remote: "Application with same name already exists"
      }
     },
    highlight: function(label) {
        $(label).closest('.control-group').addClass('error');
    },
    success: function(label) {
        label
            .text('OK!').addClass('valid')
            .closest('.control-group').addClass('success');
    }
  });

I need to do this:

Perform remote validation only if the user changes the text in the appname field. I tried using depends but am not able to make it work. This is basically what I tried:

remote: {
            depends: function(element){
            return ($('#appname').val() != "<?php echo trim($application[0]->app_name) ?>" );
            }
  • 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-04T05:03:02+00:00Added an answer on June 4, 2026 at 5:03 am

    I finally used a workaround. Which is as following

    1. Pass the original name as hidden parameter

      <input type="hidden" name="orgappletname" id="orgappletname"
        value="<?php echo $applet[0]->applet_name ?>">
      
    2. setup jQuery to compare against the original name and see if something has changed on blur. If yes then trigger ajax request to check for the changed name.

      $('#appletname').blur(function(){
       if($(this).val() != $('#orgappname').val()){
          $.ajax({
              url: "<?php echo base_url() . "apl/applet/check_applet" ?>",
              data: "appletname=" + $(this).val(),
              type: "POST",
              success: function (msg) {
              }
          });
        }
        });
      

    I am not sure if this is right way to do it, but it works for me.

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

Sidebar

Related Questions

I have form with few text boxes which goes through validation (both server and
I have a form that validates using the jQuery plugin: Validation, v1.9.0. The validation
I have the following code, which works nicely: $('#register form .submit input').click(function(){ if(jQuery.trim($('#new-usr').val()) ==
I am using jquery validation plugin for clientside validation of a form. I have
ok i have a form on which i have some validation through dataannotation which
I have a form which I create manually (a lot of JavaScript in it...).
I have a form which users must fill out and submit. The controller action
I have a form which encapsulates all the functionality, but works with a concrete
I have a form which has only tab control in it. I want to
I have a form which is a mdicontainer and has a menu strip at

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.