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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:04:32+00:00 2026-06-17T17:04:32+00:00

I have a Jquery Mobile/ asp.net mvc4 application. After the first page, subsequent pages

  • 0

I have a Jquery Mobile/ asp.net mvc4 application. After the first page, subsequent pages are called by Jquery mobile using Ajax requests. Now, I used JQuery validator plugin to perform validation on my forms, the validation is working fine first time(ie when loaded using ajax calls) but when a page is refreshed/reloaded the validation is not working. Any idea why this is happening? As this is a mobile web application there is a possibility users might refresh pages.

this is the validation code I have used:

<script type="text/javascript">    
// jquery form validation function
$(function () {
    $("#permissionRequestForm").validate({
        errorPlacement: function (error, element) {
            if (element.attr("name") === "fromTimeHH" || element.attr("name") === "toTimeHH" || element.attr("name") === "fromTimeMM" || element.attr("name") === "toTimeMM") {
                error.insertAfter($(element).parent());
            } else {
                error.insertAfter(element);
            }
        },

        //custom validation messages
        messages: {
            fromDate: "Choose From Date",
            toDate: " Choose To Date",
            fromTimeHH: "Choose From Time",
            fromTimeMM: "",
            toTimeHH: "Choose To Time",
            toTimeMM: "",
            permissionTypeOne: "Select Permission Type",
            permissionTypeTwo: "Select Permission Type",
            approverList: "Select Approver",
            reasonLeave: "Enter a Valid Reason"
        }
    });
});

  • 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-17T17:04:33+00:00Added an answer on June 17, 2026 at 5:04 pm

    This is a wild guess because code sample was not provided, I presume you have used:

    $(document).ready(function() {    
    
    });
    

    to initialize a validator plugin what is a common practice for jquery. Unfortunately document ready can not be used with jQuery Mobile.

    Also do not use :

    $(function () {
    
    });
    

    With jQuery Mobile.

    Validator plugin should be initialized in page show event, like this:

    $('#index').live('pageshow',function(e,data){    
        $.validator.addMethod("valueNotEquals", function(value, element, arg){
            return arg != value;
        }, "");
    
        $("#form1").validate({
            rules: {
                select_list : {valueNotEquals: "default"},  
            },
            messages: {  
                select_list : { valueNotEquals: "You must select a value" }
            },        
            submitHandler: function(form) {
                alert($('#form1').valid());
                form.submit();
            }
        });   
    });
    

    And here’s a working example: http://jsfiddle.net/Gajotres/AZPhK/. No matter how much time you close and return to first page, every time page is shown validator will initialize.

    EDIT :

    IF you are using multi html page format put this code only into wanted page, or better, create a new js file, put this code (all all your custom js code) in it and share it among all html pages.

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

Sidebar

Related Questions

I am developing a JQuery mobile application in ASP.net MVC4 razor using VSRC, In
I'm using ASP.net MVC4 with jquery mobile. i'm trying to change the transition page
I'm coding an application with JQuery Mobile and ASP.NET. I have a page with
I have an button in my Jquery mobile page, which is using asp.net webform.
I'm developing a mobile application using jQuery. On Microsoft Azure, I have an Asp.Net
I have an application in asp.net with jquery mobile. In this application people can
I have an asp.net mvc 4 with jquery-mobile app. On one page (url: /StatementBatch
I have developed a mobile application using jquerymobile,asp.net mvc3,HTML5. I have a scenario like
I am using JQuery mobile in asp.net web form website. I have the following
First some background: I have a website using ASP.NET web forms + jQuery 1.6.4

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.