Enter Key press and ReadC

Use this board to ask questions or have discussions with other Genie users.
Post Reply
kaindala
New User
Posts: 11
Joined: Fri Jan 20, 2017 1:48 pm
First Name: Kishan
Last Name: Aindala
Company Name: Dealertrack
Contact:

Enter Key press and ReadC

Post by kaindala »

I'm facing issue with Enter Key and ReadC.

I have a Genie grid and a HTML table, the table is created from Genie grid data using getAllDataValues.

The grid has a text input box and a combo box.

The table is shown on the screen but the Grid is hidden. Any operation happening on the table is reflected on to the Grid.

We have a OK button, with short cut key as "Enter", when a table row operation happens, like selecting a option on dropdown box, or input of text in text box we are updating genie gird using ChangeElementValue or PUI.Set (which should trigger ReadC)

It works well with button clicks on OK button, but when Enter key (keyboard) is pressed the subfile change on grid after updating values to Grid using changeElementValue, is not reflected to RPG ReadC.

I had faced issue with using the button (F9), I figured something wrong happened when (btnCA09) CA - Command Attention key was converted to RDF, it was not submitting values to the input fields on the Grid, I was able to fix this by re-creating the button and assigning the response indicator (*IN09), it took this as Command Function and it worked.

But the same thing does not work with Enter key, - which is supposed to be command function, and should assign the value to input enabled fields.

Is there a function to submit values to all input fields on the Grid? Why is the Enter key not working as required?
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: Enter Key press and ReadC

Post by Scott Klement »

I'm not sure that I understand...

1) You mention this being a "Genie Grid". Genie is a 5250 emulator, so I assume this is a grid that was added (possibly using the "detect subfile patterns" feature) to a 5250 screen. But, later you start referring to conversion to an RDF (Rich Display File). In that case, it's not a Genie Grid, it's a Rich Display Grid, right? But then you start referring to how things are supposed to be Command Attention or Command Function, which seems to be referring to the CFxx/CAxx DDS keywords... which are green screen, not Rich Display. But then, you refer to Enter as a "Command Function"... but Enter isn't a command function in green screen, either... You can't catch enter with the CFxx keywords... CFxx can be CF01, CF02...CF24. It can only handle numbers 1-24 for function keys F1-F24. It cannot be used for Enter in green screen OR Rich Display. So I'm really confused about what you're asking.

2) You said that it was an error that CA09 converted to a button that did not send the contents of the grid back to your program... but that's the correct behavior for a CA09!! It should not send the data back, that's the whole point of CA (Command Attention). You don't need to delete a button and create a new one to change that behavior, you only need to change the "bypass validation" property. This is the Rich Display equivalent of "CAxx" vs "CFxx". When bypass validation is true, the Rich Display acts like a green screen would if it used CAxx, it does not submit data back to the server. When it is false, it behaves like the green-screen CFxx would, and does submit the data back.

Whether it is bound to *IN09 or not does not affect this. That only affects whether *IN09 is turned on when the button is pressed.

3) Its not at all clear what this sentence means:
We have a OK button, with short cut key as "Enter", when a table row operation happens, like selecting a option on dropdown box, or input of text in text box we are updating genie gird using ChangeElementValue or PUI.Set (which should trigger ReadC)
It seems like you accidentally combined two different sentences or something like that? It starts by talking about a button with a short cut key, but then you say that it happens when a row operation happens. What?! The OK Button happens when an option is selected in a dropdown, or a text box is changed? But then you say that you're doing a changeElementValue (aka pui.set). My guess is that you're doing the pui.set when the data changes, right? But, what does that have to do with the button that has a short cut key? I'm completely lost on this.

4) You ask "Is there a function to submit values to all input fields on the Grid? Why is the Enter key not working as required?" Its not clear what you are expecting the enter key to do... And, as far as submitting all the fields on the screen goes... this can be done with a button that has the response property set, or it can be done with the pui.click() API, or by pressing enter. Or probably a half dozen other ways.
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: Enter Key press and ReadC

Post by Scott Klement »

Here are some common mistakes that may or may not apply to your situation (honestly, I don't understand your situation, so what I'm saying may be completely unrelated...)

a) Please understand that by default the ENTER key will submit the whole screen. If you need the user to click a button (because you wrote code that runs in the "onclick" event, for example), or activate the button via Enter as a shortcut key, then it is important that you disable the default behavior of the Enter key. This is done by setting the "disable enter" screen-level property to true.

b) You cannot set both a response and an "onclick" on the same button (or image, hyperlink, etc.). You must use either one or the other, never both. If you need to turn on an indicator AND run some JavaScript code, then you can use the "onclick" property to run the code.... and add a second button that has "visibility=hidden" so the user can't see it. Use the "response" prpperty on the hidden button to turn on the indicator. Have the last statement of the onclick code (in the first button) run pui.click("second-button-id") to execute the hidden button's response property to submit the screen and set the indicator.

c) If you are using the screen's "onsubmit" function, you may not use it to run pui.set() or changeElementValue() or similar calls. This is because the screen data to be submitted has already been collected prior to this function being called, so if you change the screen elements during this function, the changes will not be submitted to the server.

d) Make sure "bypass validation" is turned off for a button that submits the screen. If it is turned on, no data will be sent.
kaindala
New User
Posts: 11
Joined: Fri Jan 20, 2017 1:48 pm
First Name: Kishan
Last Name: Aindala
Company Name: Dealertrack
Contact:

Re: Enter Key press and ReadC

Post by kaindala »

Please see the attachment for all details on the issue
Enter Key - ReadC issue.docx
(879.68 KiB) Downloaded 218 times
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: Enter Key press and ReadC

Post by Scott Klement »

From your screenshots, it appears that this is a Rich Display and therefore not a Genie question.

Is the processRowSelect() function being called when you press enter? You say that press enter "doesn't work", but you haven't provided any detail on that. Is it being called? If it is being called, are there any errors?

If its called and there are no errors, then most likely it is a timing error... the data on the screen is submitted before your routine is run.

If its not called, then you need to discover why. You've added it with jQuery to the window's keyup event... so if that part isn't working, it's not even a Profound UI problem. (jQuery is not part of our product) If this is happening, you need to debug things and find out what's happening.
kaindala
New User
Posts: 11
Joined: Fri Jan 20, 2017 1:48 pm
First Name: Kishan
Last Name: Aindala
Company Name: Dealertrack
Contact:

Re: Enter Key press and ReadC

Post by kaindala »

Scott Klement wrote: If its called and there are no errors, then most likely it is a timing error... the data on the screen is submitted before your routine is run.
Yes it is called. I do not understand how this can be timing error.. because the screen is not submitted to RPG code until the pui.click("btnSubmit") is executed.

The issue is below code works with mouse click on the button and does not work when Enter key is pressed. So what is wrong with Enter key?

// Loop through all table rows and reset subfile ReadC indicator
for (i = 0; i < tr.length; i++) {
var rrn = i + 1;
rowInd = tr.cells.namedItem("rowInd").innerHTML;
opt = tr.cells[0].getElementsByTagName("input");
if (rowInd == "selOpt") {
changeElementValue("$OPT." + rrn, opt.rowOptInp.value);
pui.set( "$CPOS", rrn);
}
}
pui.click("btnSubmit");
kaindala
New User
Posts: 11
Joined: Fri Jan 20, 2017 1:48 pm
First Name: Kishan
Last Name: Aindala
Company Name: Dealertrack
Contact:

Re: Enter Key press and ReadC

Post by kaindala »

Scott Klement wrote: If its not called, then you need to discover why. You've added it with jQuery to the window's keyup event... so if that part isn't working, it's not even a Profound UI problem. (jQuery is not part of our product) If this is happening, you need to debug things and find out what's happening.
I added the jQuery keyup, because when enter key is pressed it was not trigging the onClick event on the button. "Enter" is a shortcut key for the "btnOK".
When a shortcut key is applied to a button, which event will be triggered? As I do not see onClick being triggered.
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: Enter Key press and ReadC

Post by Scott Klement »

If I create a display with a button, shortcut key = 'enter' and 'disable enter key = true', then when I hit enter, the button's onclick event fires. I don't know why it wouldn't happen for you -- I would suggest that you debug your code and determine that.

A timing error would occur when more than one thing is trying to submit the screen at the same time. For example, if "disable enter key" is not "true", then pressing enter will submit the screen at the same time as the onclick event runs, so the work in the onclick event would fire, but the code it runs wouldn't have any effect since the other submission occurs before it has completed. Likewise, if you had multiple widgets that used the enter key as shortcuts, that would cause the same thing.

It's hard to tell you what is wrong with your program. If you can point to something that's actually wrong with Profound UI (rather than your code) and tell us exactly what it is and how to reproduce the problem, then please file a support ticket for it. (Posting here in the forums is NOT filing a support ticket.)

If you can't tell us exactly what is wrong with Profound UI or how to reproduce it, then you need to debug your code to find out the exact thing that is wrong.

IF you really want to hire Profound to debug your code for you, you can... but I don't know how soon our consultants would be available to work on it. to hire us, contact sales@profoundlogic.com
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests