Solved

Need to override the keyup function with a home grown function

Posted on 2011-09-21
5
361 Views
Last Modified: 2012-05-12
I have a jqGrid validation methodology that's killing performance, due to the fact that the validateDuplicates function is being injected into the keyup event. I want to use my own function which would only return true if a duplicate is found, and at that point a performance hickup is okay.

Can someone tel me how to make up my own function, and make it chainable?

Right now I have this:
$('[id^="Container_"]).keyup(validateDuplicates).change(validateDuplicates);

I need (at least I think I need) to write an alternative to keyup, call it displiatesFound. And in there I'd add each barcode to a list, after checking if it already existed. If it did exist, two duplicates are found.

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 40

Expert Comment

by:gurvinder372
ID: 36578152
why don't you simply unbind the keyup event and see what happens?
0
 

Author Comment

by:newbieweb
ID: 36578167
Not sure what you mean by unbinding...
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36578176
$('[id^="Container_"]).unbind("keyup");
0
 

Author Comment

by:newbieweb
ID: 36578199
But then what action (or event) would call the jquery default error code?

Here's what I was going to do. Please tell me if this will work. Oddly, it seems to and I have not yet even created my own duplicates test. I planned to insert it inside the anonymous function I created.

$('[id^="Container_"]).keyup(function () {
     validateDuplicates()
}).change(validateDuplicates);

What do you think?
0
 

Author Closing Comment

by:newbieweb
ID: 36578249
I think my code unbinded it in a different way. Thanks.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

738 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