?
Solved

Unobtrusive behavior for field validation is too slow

Posted on 2011-09-26
5
Medium Priority
?
358 Views
Last Modified: 2012-05-12
We use a jqGrid to contain multiple pairs of input fields and we currently use Unobtrusive JavaScript behavior to validate the fields. The problme is that there are far far too many calls, since this type of validation confirms every field against every other field already entered, as it looks for duplicates. Thie create over 30,000 calls for 10 records! We neeed to support over 50 records, so this is a hufge problem.

What I would like to do is validate the current field only. When the user mouses away or even mouse clicks that field, I'd like to NOT re-run the validation that's already been validated.

Any idea how to do this with jQuery and jqGrid?

Thanks.
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36704867
What is the validation you need per field and what do you NOT want to run again?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36708426
When you say "Unobtrusive JavaScript behavior" - do you use a specific library or do you just mean

window.onload=function() {
...
}

or

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

and is this a duplicate of I need to speed up validation done by jqGrid
0
 

Author Comment

by:newbieweb
ID: 36708957
I deleted the other one. They were a little different but mostly the same.

The jqGrid is configured with AJAX to handle all validation on creation of the jqGrid. But the amount of validation going on is crazy. It's because we require the fields to be unique and it runs its uniqueness test each time it runs, and this creates an exponential number of calls needing to be made. I started writing my own validation, but would be happy to use jqGrid's if it had an option to run like the one I will write.

When the user enters a new value, I will check it for duplicates against all other values already entered. When I display the new duplicates in Red, I will NOT clear out prior duplicates (also shown in red). If I cleared it out, that would mean I needed to recheck the entire list each time, which creates exponential growth in the number of comparison checks, which kills performance.

So I wonder if jqGrid has this option.

Thanks.
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 1500 total points
ID: 36709387
That is a VERY specific question

Did you try asking it here: http://www.trirand.com/blog/?page_id=393
0
 

Author Closing Comment

by:newbieweb
ID: 36719385
Thanks for the link.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question