Windows, pressKeys, JavaScript

Use this board to ask questions or have discussions with other Genie users.
Post Reply
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Windows, pressKeys, JavaScript

Post by dkmccammon »

I will do my best to describe the issue I am facing. I currently have a screen where a user will click on a magnifying glass where on the green screen was an F4 to prompt the field. I have the javascript working to pull up that window (window on the green screen), then the user clicks on their selection and I have the javascript working to put the value in the text box and press enter for the user.

Now here is where my issue really starts, in order for the change to actually take place on the screen the user needs to press the enter key again to "update". The enter key does not need to be pressed if there are no changes. Since the window changes the element and presses enter, the value on the main page will appear to never change according to the javascript because it is already changed before page is loaded and the javascript ran. I cannot have the enter key pressed on page load of course because it loops and just keeps pressing enter disabling all functionality of the screen. I also have not figured a way to store the previous values of the element and compare that with the changed elements since the previous element will always be replaced with the changed value and therefore changing the "previous value" in the javascript before it has a chance to evaluate the true previous value. In other words the values would always match.

Is there a way to identify when a window closes so that I can capture that action on the main screen, and then apply a javascript action to press the enter key.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Windows, pressKeys, JavaScript

Post by Scott Klement »

In 5250, it doesn't really "remove a window", it just redraws the screen. So if it draws a screen, and does not draw a window -- this can appear to the user has if the window was "removed". But there isn't anything sent that says to remove a window, instead it is just drawing a new screen.

Keeping a variable between screens is very easy. JavaScript variables that begin with "window." are global variables (i.e., not local to the function they are in) and therefore will remain until the session ends or is refreshed.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests