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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:48:03+00:00 2026-05-18T05:48:03+00:00

I am using Update Panel in my asp page and I am doing JQuery

  • 0

I am using Update Panel in my asp page and I am doing JQuery Validation on Asynchronous Postback…

I just want to validate my form on only button clicks or submits…
My problem is..all my buttons are in different formviews and won’t load at a time…that’s why I am unable to take the button id’s and use the click events..here is my code..

 Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(ValidateMyForm);
 function ValidateMyForm(sender, args) {
            var objPost = args.get_postBackElement();
            if (objPost === null || objPost === undefined) return;
            if (objPost.id == '<%= ((Button)(formViewinfo.FindControl("btnUpdate"))).ClientID %>') {
                $('#pnlerrors').fadeOut('fast');
                $('#pnlItemErrors').fadeOut('fast');

                var isValid = $('#form1').validate({
                    errorClass: 'error',
                    invalidHandler: function (e, validator) {
                        var errors = validator.numberOfInvalids();
                        if (errors) {
                            $('#pnlerrors').html('<p>&nbsp;Please correct the errors  </p>').fadeIn('fast');
                            document.location.href = '#pnlerrors';
                        }
                    }, submitHandler: function () {

                    }
                }).form();

                if (!isValid) {
                    CancelPostback(sender, args);
                } else {

                }

            }
            //this is for rest of buttons
            else {
                $('#pnlItemErrors').fadeOut('fast');
                $('#pnlerrors').fadeOut('fast');
                var isValid = $('#form1').validate({
                    errorClass: 'error',
                    invalidHandler: function (e, validator) {
                        var errors = validator.numberOfInvalids();
                        if (errors) {
                            $('#pnlerrors').fadeOut('fast');
                            document.location.replace('#', '#pnlItemErrors');
                            $('#pnlItemErrors').html('<p>&nbsp;Please correct the errors </p>').fadeIn('fast');
                            document.location.href = '#pnlItemErrors';
                        }
                    }, submitHandler: function () {
                    }
                }).form();

                if (!isValid) {
                    CancelPostback(sender, args);
                } else {

                }

            }
        }

All I want to do is: 2nd time validation on only button submit not for everything…I do get other postbacks on this page and those post backs also gets validated each time (I want to Avoid this)…

I don’t know this approach is good or not…I am struggling with this from long time..I really appreciate you help…

  • 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-18T05:48:04+00:00Added an answer on May 18, 2026 at 5:48 am

    On the assumption that you don’t want to submit the form when someone presses the enter button, and that you only want to submit the form on pressing a submit button:

    $(document).ready(
        function(){
            $('form').keypress(
                function(event){
                    if (event.keyCode == '13'){
    
                        return false;
                    }
                });
            $('input:submit').click(
                function(){
                    $(this).closest('form').submit();
                });
            $('form').submit(
                function(){
                    $('#success').text('form submitted! (Not really...)');
                    return false;
                    // Just to stop the error messages
                    // in this demo.
                });
        });
    

    There’s a JS Fiddle demo, here: http://jsfiddle.net/davidThomas/5PaWz/.

    If I’m mistaken in my assumptions, please leave a comment and I’ll try to correct myself.

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

Sidebar

Related Questions

I want to recreate the the update panel postback without using an update panel
Hello, I am using update panel in my ASP.net page for partial page postbacks.
I'm using an Ajax update panel and have recently added ASP.NET tracing code to
I'm just starting to wean myself from ASP.NET UpdatePanels. I'm using jQuery and jTemplates
I have a gridview in an update panel and am using a jQuery dialog
Is there an ASP.NET AJAX framework other than just using UpdatePanel & Friends or
I am using the jQuery nyroModal plugin within ASP.Net. I love nyroModal, and overall
I have been using asp.net programming just from few months and I have to
I'm bulding an ASP.NET website just to test my skills, and I'm using lots
i am using asp.net 4.0 iis 7.5 microsoft visual studio 2010 what i want

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.