Workflow Soluiton

 View Only
  • 1.  Hitting 'Enter' in Workflow

    Posted Jul 09, 2009 02:07 PM
    I'm trying to have a user enter a search string in a text box, then click the "Search" button OR just hit Enter.  I'm pretty sure I've done this before, but for the life of me I can't remember how to map the 'Enter' key from the text box to the "Search" button.  I don't remember if it was a component, a behavior, or something else.  Can anyone help?

    -Steve


  • 2.  RE: Hitting 'Enter' in Workflow

    Posted Jul 09, 2009 03:50 PM
    I believe you have to set the Tab Index to 0 or 1 on the Search button in your Form. That way when the page loads it will be the first thing the page has selected.


  • 3.  RE: Hitting 'Enter' in Workflow

    Posted Jul 09, 2009 07:47 PM
    Yeah, but then the user will click in the search box to type, and the button will lose the focus.  The Tab Index makes it easy for the user to type, hit tab, THEN hit enter, but I want to just be able to hit enter from within the text box.


  • 4.  RE: Hitting 'Enter' in Workflow

    Posted Jul 10, 2009 12:32 PM
    You might be able to write a custom javascript keypress event for the form that checks for return/enter being pressed and simulates the button click. In javascript, I believe the event.keycode is 10 or 13... can't remember off the top of my head.


  • 5.  RE: Hitting 'Enter' in Workflow

    Posted Jul 14, 2009 09:12 PM

    Ok, I'm not sure what's going on, but I created a new form and the Enter key functions as expected.  But no matter what I do, I can't make the first form work.  I have removed and replaced the text boxes and buttons, but I get the same result.  I will recreate the whole form next, but if anyone has any theories I'd be glad to hear them.



  • 6.  RE: Hitting 'Enter' in Workflow
    Best Answer

    Posted Jul 17, 2009 08:37 AM
    Here's what I do:
    Give the button a name by Edit Component -> Tab: Functionality -> Check Specify Control Id -> Type Name eg. 'btnEnter'
    In the textbox component Edit Component -> Tab: Functionality -> Custom Events:
    Click Add -> AttributesKeyValuePair
    Event: onKeyPress
    Event Handler: if (event.keyCode == 13){ event.returnValue=false;event.cancel = true;btnEnter.click();}

    Hope it helps


  • 7.  RE: Hitting 'Enter' in Workflow

    Posted Jul 22, 2009 01:37 PM
    Thanks claus66 and reecardo!  That works great for forms with multiple outputs (like a user lookup w/ search box).  I have done similar things with 'onDblClick' (such as on grid displays) but I couldn't figure out the format for 'onKeyPress'.  The code you provided works perfectly.


  • 8.  RE: Hitting 'Enter' in Workflow

    Posted Jul 23, 2009 02:07 AM
    Claus66: Thanks for this code!

    Do you have any reference of which language is used in there and how to get more out of that "coding" possibilities? I just can't find any documentation about the language or syntax which can be used.


  • 9.  RE: Hitting 'Enter' in Workflow

    Posted Sep 10, 2009 01:34 PM
     Steve,

    I've had the same problem you describe. I could not get a button on a form to press when I hit "Enter" from the field I was filling out. From inside the form, you have to go into the "Browser" tab (by default, it's on the lower left of the Designer window) and make sure that the button you want to have activated when Enter is pressed is higher up on the list than any other button.

    However, I've found that the JavaScript already shown in this topic is the most effective way to make sure your button gets pressed.

    On a side note, I have a form that will not activate a specified button even when I have used the JScript above... My button and the field that is supposed to activate it are both in a panel. As soon as I added them to the panel,  could not longer press "Enter" to activate the button.