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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:36:14+00:00 2026-05-20T08:36:14+00:00

I am using asp.net mvc 3 jquery validate unobstructive javascript. I am trying to

  • 0

I am using

asp.net mvc 3
jquery validate
unobstructive javascript.

I am trying to write all my validation on the serverside through annotations and then have the new feature of mvc 3 take care of the client side.

I have a dialog that has a button on it(just a button not a submit button) that I want to post data to the server through ajax.

So when the user clicks on the button I do a form submit and return false to cancel the post back.

I thought that would trigger the validation but that does not seem to be the case. How do I make the client side validation trigger?

Edit

<form method="post" id="TaskFrm" action="/Controller/Action">

            <input type="text" value="" name="Name" id="Name" data-val-required="Name field cannot be left blank" data-val-length-max="100" data-val-length="task cannot exceed 100 characters" data-val="true">
</form>

var $dialog = $('<div></div>').dialog(
            {
                width: 580,
                height: 410,
                resizable: false,
                modal: true,
                autoOpen: false,
                title: 'Basic Dialog',
                buttons:
                    {
                        Cancel: function ()
                        {
                            $(this).dialog('close');
                        },
                        'Create Task': function ()
                        {
                            var createSubmitFrmHandler = $(my.selectors.createFrm).live('submit', function ()
                            {
                                alert('hi');
                                return false;
                            });

                            createSubmitFrmHandler .validate();
                            var a = createSubmitFrmHandler .valid();

                            alert(a);

                        }
                    }
            });

This always return true.

Edit 2

if I put a submit button within the form it will show the clientside validation(I use jquery to return false as shown in my code).

So this means I do have the scripts and everything but it is not working for unknown reasons when I try to do it programmatic.

Edit 3

I stuck the jquery validate && jquery.validate.unobtrusive files in the master page. But when I stick them in the partial view that contains the fields that get loaded up and then force a submit the validation kicks in.

I don’t understand. I pretty sure the pathing is right as I just dragged and dropped the file into my master page and it figured out the path. Having it in the partial views is not really a solution as I going have to do this multiple times and that means every time the partial view loads up I got another copy of these files.

Edit 4

I think it is just the jquery.validate.unobtrusive that needs to be for some reason loaded every time. I am not sure why though.

  • 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-20T08:36:14+00:00Added an answer on May 20, 2026 at 8:36 am

    Something like this should do the trick:

        $("#my-button").click(function (event) {
            event.preventDefault();
    
            $("#my-form").validate();
    
            if ($("#my-form").valid()) {
                // ...
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using asp.net mvc 2.0 and jquery validate 1.7 ( http://bassistance.de/jquery-plugins/jquery-plugin-validation/ ) What
I'm using ASP.NET MVC Framwork and trying to grok the ASP Membership 3.5 stuff.
I am using jQuery1.4.2, ASP.NET MVC 2 and jQuery.UI-1.8. I am creating a data
I am using JQuery validator plugin on ASP.NET MVC Page as below. 1). Here
I need to implement a regular expression in my asp.net mvc(C#) application using jquery.
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using asp.net MVC I'd like to do this inside a view: <%= Html.TextBox(textbox1, null,
I'm using ASP.NET MVC Preview 4 and would like to know how to use
If you are using ASP.NET MVC how are you doing grid display? Rolled your
I am using asp.net mvc for an application. I've taken some guidance from Rob

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.