Video Screencast Help

Using the Enter key to trigger the "Check For User" path

Created: 10 Dec 2013 • Updated: 17 Dec 2013 | 7 comments
Lark's picture
This issue has been solved. See solution.

When using the Advanced Incident form, after entering a user's e-mail address in the Select User input box you need to click on the button next to it.  This triggers the "Check for User" path that verifies you have entered a userid ServiceDesk recognises and populates the Primary Contact details for the incident.  The button I am referring to is the little user icon with a check box in its bottom right corner.

SelectUser.PNG

Having to move a hand off the keyboard and grab the mouse is quite slow.  It would be faster to simply hit the Enter key and have it trigger the same Check for User path.  While workflow was performing a lookup and reloading the form the support person could then reach for the mouse to prepare to add other incident content.

Can anyone please advise on how I can set this up?  I know this might sound trivial but it would really help with the flow of using this form.

Operating Systems:

Comments 7 CommentsJump to latest comment

reecardo's picture

There are several articles that I've responded to that show how to add custom javascript, like this one (if you search for custo javascript, you'll get several more, I've even done a video):

https://www-secure.symantec.com/connect/forums/jav...

1. Make the Control ID of the button "woohoo" (no dbl quotes)

2. For the Form, add an OnKeyPress Custom Event and add the event handler script as follows:

//BEGIN

var button = document.getElementById('woohoo');

if(event.keyCode == 13)

{

button.click();

}

//END

This is untested, but I think it should work.

SOLUTION
Lark's picture

Thanks reecardo - it was a case of not really knowing what to search for.  I did try a couple of search but nothing useful seemed to come up.

I have added an AttributeKeyValuePair with an OnKeyPress event and the script as you have suggested to the textbox.  I also added the Control ID to the "Check for User" button.

It doesn't seem to work though.  Is there somethnig that could suppress this?

reecardo's picture

I don't have Designer immediately in front of me, but the problem probably lies in either hooking this event to the form vs. the body. I'd try doing it in both places... see if you can get good results.

Using built-in developer tools in a browser (Firefox/Chrome) is a good way to test this, as you can debug into the JS and tell if it's firing or not.

jpellet2's picture

The other option which I am using (because I can't seem to get this to work right now either for some reason) is to enable a tab stop on the "Check for User" button. Just be sure to change the order of the tab since if you enable it it will actually be the tab stop before the input box however since the input box is active on load, you'd have to tab all over the page before getting to it. All I did was swap tab order between this button and the select user text box (I think I made the button 11 and the text box 3). This sets the button as the next element selected when tabbed after the text box.

I'd like to figure out the javascript as its a lot more elegant, it just isn't working right this moment.

jpellet2's picture

A quick update to my previous response. I have the java script working when added to just the form's OnKeyPress event and the tab stop, while possible, isn't working right. 

First, the java code is working fine in FF and Safari but just doesn't want to work in IE so it could be an IE thing or something else I have wrong somewhere. 

The TabStop is trickier. In this case it worked in the debugger but when put into production the tabs top was enabled just not in the order I thought it would be. Looking back at the form, the tabstop for the text box is 11 however the tabstop for the button is actually 8.3. The button is on the panel so since the panel doesn't come after the text box, not matter what number I make for the button, it won't come after the text box unless I change the tab order of the entire page. At this point, since all of my staff are Mac users I won't worry about the tabs and will be pleased that the key press is working.

Lark, try publishing the page and attempt to use another browser other than IE if you can to see if your changes work there and then look at what might be causing IE to not function, as I will do when I have time.

SOLUTION
Lark's picture

Thanks jpellet2,

The code I have is working in Chrome v31 but not in IE9 or IE11 (in compatibility mode).

I'll keep digging and post if I find anything.

 

Lark's picture

Ok got it.  From what I can tell, the issue for IE is that the onkeypress event is not supported.  Chrome, Firefox and Safari do support it which is why it was working ok for these browsers.  For me, the fix was to change the Event to "onkeyup" which is supported by all.   Hitting enter after typing in a user e-mail now works in IE.

Thanks to reecardo and jpellet for their help.

For anyone reading this and wanting the full steps here they are for SD 7.5 SP1

  1. Log onto your ServiceDesk Server with an admin account
  2. Open the SD.Feeder.TechnicianIncidentForms workflow (either from Workflow Manager or by double clicking on the SD.Feeder.TechnicianIncidentForms.package file if you've never edited it before)
  3. Ensure the Primary model is selected on the left hand tree.
  4. In the center of the workflow you will find the "Create Incident" component.  Double click it to open it
  5. Once the form opens, double click on the little user search icon next to the user name input box.  This is the icon to the right of the box with [PrimaryContactDisplayName].
  6. On the functionality tab, scroll down to "Control ID" and enter "woohoo" (without quotes).  Click OK
  7. Double click the box with [PrimaryContactDisplayName] in it.
  8. In the Functionality tab, scroll down to the Behavior section.
  9. For Custom Events, click the Add button and choose AttributesKeyValuePair
  10. In the resulting window, choose the "onkeypress" event and put the following in the Event Handler input box:

    //BEGIN

    var button = document.getElementById('woohoo');

    if(event.keyCode == 13)

    {

    button.click();

    }

    //END

  11. Click OK for that Edit Object window

  12. Click OK for the Edit Component window

  13. Click OK for the Web Form Editor Window

  14. Save and Debug/Publish as you normally would

SOLUTION