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

  • Home
  • SEARCH
  • 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 3425744
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:37:51+00:00 2026-05-18T06:37:51+00:00

I have setup a simple example to show a form inside a jquery UI

  • 0

I have setup a simple example to show a form inside a jquery UI dialog and wish to enable inline client side validation on that form

I have then added the scripts to my master page

<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/jquery-1.4.3.min.js" )%>"></script>
<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/jquery.validate.min.js" )%>"></script>
<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/MicrosoftMvcJQueryValidation.js" ) %>"></script> 

and then I have enabled Client Side Validation through the following code

<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm() { %>
<% } %>

Then, I dont know how to enable inline validation for every input so when the user leaves the focus from any of them validation occurs.

The client side validation seems to work only after I have done a submit. But that is not a “client side validation” as the attributes get validated from my server code…

Any suggestion?

  • 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-05-18T06:37:51+00:00Added an answer on May 18, 2026 at 6:37 am

    Finally I have got through the solution.

    First of all, my forms were never binded to validation callbacks provided by the code inside the MicrosoftMvcJQueryValidation.js script. This because I am using jQuery dialogs and the form is inside the dialog while the script included in the master page.

    My first attempt toward the solution has been to modify the MicrosoftMvcJQueryValidation.js. In particular I have added a function EnableClientSideValidation() where I moved the code that was in the $(document).ready function as in the following code sample

    function EnableClientSideValidation() {
        var allFormOptions = window.mvcClientValidationMetadata;
        if (allFormOptions) {
            while (allFormOptions.length > 0) {
                var thisFormOptions = allFormOptions.pop();
                __MVC_EnableClientValidation(thisFormOptions);
            }
        }
    }
    
    $(document).ready(function () {
        EnableClientSideValidation();
    });
    

    Then I have called the same function inside a script block that I have placed in the dialog markup code $(document).ready() function

    With the help of firebug I have placed a breakpoint inside the EnableClientSideValidation() function and then experienced the fact that was called only when the main page was ready but not from the dialog. This was due to the fact that I had my “dialog” script block inside the <form>...</form> tag and so the script did not worked.

    Code like this

    <% using (Html.BeginForm()) { %>
    
        //DIALOG FORM CODE WAS HERE
    
        <script type="text/javascript">
        $(document).ready(function () {
            EnableClientSideValidation();
        });
        </script>
    <% } %>
    

    has been changed to

    <% using (Html.BeginForm()) { %>
    
        //DIALOG FORM CODE WAS HERE
    
    <% } %>
    
    <script type="text/javascript">
    $(document).ready(function () {
        EnableClientSideValidation();
    });
    </script>
    

    Finally everything started working! I would like to thanks vandalo and kdawg for helping in finding a solution. There was something still missed but your answers have stimulated my head.

    I am posting this for other that can have the same problem.

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

Sidebar

Related Questions

I have a really simple ASP.NET web application and a web setup project that
A simple question: I have a Model-View-Controller setup, with Models accessing a SQL database.
At the moment I have setup a custom ok cancel dialog with a drop
I have setup web dav on windows server 2008. It seems to work fine
I have setup a property and implement INotifyPropertyChanged like so... public event PropertyChangedEventHandler PropertyChanged;
I've created some MbUnit Test Fixtures that have SetUp methods marked with the SetUp
I am trying to implement performance testing on ActiveMQ, so have setup a basic
Setup Have you ever had the experience of going into a piece of code
I have a setup project created by Visual Studio 2005, and consists of both
I have a setup executable that I need to install. When I run it,

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.