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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:45:21+00:00 2026-06-06T16:45:21+00:00

I have an eventhandler function for a textbox, that does the following, Searches the

  • 0

I have an eventhandler function for a textbox, that does the following,

  • Searches the contacts of the user and displays, the contacts that matches the pattern
    of the textbox

The same function should be done for two more textboxes.

Since the value of the textbox is obtained using “e.parameter.textbox1NAME”, I have added two more functions as event handlers,

textbox2.addKeyUpHandler('search2');
textbox3.addKeyUpHandler('search3');

in addition to

textbox1.addKeyUpHandler('search1');

The only difference among the three functions is whether the pattern used is,
“e.parameter.textbox1NAME” or “e.parameter.textbox2NAME” or “e.parameter.textbox3NAME”

I think this is inefficient, is there any way to know which element invokes the handler or which element is in focus?
Thanks

  • 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-06-06T16:45:22+00:00Added an answer on June 6, 2026 at 4:45 pm

    Srik answer is very smart ! I liked it and wanted to give it a try… here is an example to illustrate !

    function multitext_test() {
      var app = UiApp.createApplication().setHeight('150').setWidth('200');
      app.setTitle("test these textboxes");
      var panel = app.createFlowPanel();
      var txt1 = app.createTextBox().setName('txt1').setId('txt1');
      var txt2 = app.createTextBox().setName('txt2').setId('txt2');
      var txt3 = app.createTextBox().setName('txt3').setId('txt3');
      var label = app.createLabel('type in any of these textBoxes').setId('label')
      app.add(panel.add(txt1).add(txt2).add(txt3).add(label));
      var QHandler = app.createServerHandler("key").addCallbackElement(panel);
      txt1.addKeyUpHandler(QHandler);
      txt2.addKeyUpHandler(QHandler);
      txt3.addKeyUpHandler(QHandler);
    //  
      var doc = SpreadsheetApp.getActive();
      doc.show(app);
    }
    //
    function key(e){
      var app = UiApp.getActiveApplication();
      var src = e.parameter.source;
      var newValue = e.parameter[src]; 
      var act= app.getElementById(src)
      label = app.getElementById('label')
      label.setText("You typed '"+newValue+"' in textBox nr "+src.substring(3));
      act.setStyleAttribute('background','yellow');
      return app
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I use GWT and I have a com.smartgwt.client.widgets.Button that has the following eventHandler:
I have a function that adds eventhandlers to control events. Right now I have
On the MSDN, I have found following: public event EventHandler<MyEventArgs> SampleEvent; public void DemoEvent(string
I have a class Yarl in my code with a member function refresh that
So I have my nifty function that detects changes for me in a form:
I have a general function that is supposed to handle any event in the
I have the following form which intercepts the ENTER key so that when the
I have the following function in Flex 4: protected function initEventHandlers():void { imageContainer.addEventListener(DragEvent.DRAG_ENTER, acceptDrag);
I have a third-party editor that basically comprises a textbox and a button (the
I have a gridview that displays the contents of a database table, using an

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.