custom widget div value

Use this board to ask questions or have discussions with other Genie users.
Post Reply
sfoster
New User
Posts: 5
Joined: Tue Mar 21, 2017 10:44 am
First Name: Sheldon
Last Name: Foster
Company Name: Dealertrack
Contact:

custom widget div value

Post by sfoster »

I have searched the forums and I couldn't find anything that matched closely enough to feel like I have a definitive answer to this.

I have created a custom widget that is an <input> element inside a <div> element. I cannot get the value to pass back to the rpg program. I suspect it is because the highest level element is not an <input> type of element - it's a div.

Is there a way to pass this value somehow? (without modifying the proddata files or using a "hacky" hidden field to track the actual value)
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: custom widget div value

Post by Scott Klement »

How are you trying to get the data to be passed back? You posted this in the Genie forum, can I assume therefore that this is meant to be used on a 5250 display? If so, the only data that is sent back is the data that was on the original green-screen. So you have to copy your data into a I_x_x type field that will be passed back to the original green-screen.

If you're referring to Rich DIsplay, only certain properties (pre-defined by Profound) are bi-directional. For your own custom properties, they will be output-only. You will need to either copy the data to an existing bidirectional widget like a hidden textbox, or you will need to manually insert the data into the response object in an onsubmit event.
sfoster
New User
Posts: 5
Joined: Tue Mar 21, 2017 10:44 am
First Name: Sheldon
Last Name: Foster
Company Name: Dealertrack
Contact:

Re: custom widget div value

Post by sfoster »

Thank you Scott for your quick reply.

You are correct - I should have posted this in the Rich Display forum.

Here's a snapshot of the custom widget - I can attach the JavaScript used to create it if you'd like.
searchSnap.PNG
searchSnap.PNG (2.2 KiB) Viewed 3026 times
I've associated a 15-character field named 'SEARCH' with it's value in the Profound UI designer, but in debugging the rpg, the value is always passed back as blank. You mentioned that there's a way to tie in to the response object and I see in the documentation that there is a pui.applyResponse() method. Is this what you are referring to? If not can you point me in the right direction?

Thanks.
Last edited by sfoster on Tue Mar 21, 2017 3:24 pm, edited 1 time in total.
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: custom widget div value

Post by Scott Klement »

Why did you bring up Universal Displays? I'm lost.

I asked you if this was 5250 vs. Rich DIsplay. You came back with info about not using Universal Displays.... I'm not understanding why you're bringing them up, as they have nothing to do with this conversation AND you're not using them.

5250 is the old-school type of IBM workstation/terminal that the old AS/400 systems used. They worked like Mainframes where they had one CPU with lots of terminals that people used to work from. Today's IBM i is nothing like the AS/400 (depite that some people still use that terminology), today we use PCs, mobile devices, etc as clients instead of terminals. But, still, a lot of old applications use 5250, using emulation software to let a window on our PCs look like a terminal.

Genie is a 5250 emulation software that will convert the old 5250 terminal output into a web page, and can add additional widgets and customizations on top of that web page.

Rich Display is a whole different type of display that supports a GUI interface (with a high amount of backward compatibility to older RPG paradigms) but does not use 5250 at all. It is pure HTML5/JavaScript/CSS. Genie _also_ supports Rich DIsplays and can switch between 5250 mode and RIch Display mode as required by the application.

But, normally, when someone has a question about RIch DIsplay, they post it in the Rich DIsplay forum despite that Genie can run them. They use the Genie forum for Genie-based 5250 displays.

Since you did not specify which you were using, I first explained 5250 displays, then Rich DIsplays.

None of that has anything whatsoever to do with Universal Displays, which are a completely different animal, entirely.
sfoster
New User
Posts: 5
Joined: Tue Mar 21, 2017 10:44 am
First Name: Sheldon
Last Name: Foster
Company Name: Dealertrack
Contact:

Re: custom widget div value

Post by sfoster »

I'm well aware of what a 5250 is and I understand what emulation is. I've been working on the AS400 / iSeries since 1994. But I'm still learning Profound and the associated terminology. Genie, Rich Display, Universal Display, etc. etc. Hmmmm.

I only mentioned Universal Displays because I was under the impression that Universal Displays = Rich Displays and that logic led me to post in the Genie forum. The logic was: "since I know it's not this, it must be this". In other words, I knew it was not Universal Display, and since in my mind Rich Displays = Universal Displays it must therefore be Genie.

Unfortunately I was in the middle of editing my previous post when you submitted your response so now the thread may not make as much sense, since it does not even include the bit about Universal Displays.

In any case, I still am looking for a solution. If you see my previous post (now edited), I've included a screenshot of the actual widget. And here I am including a screenshot of the Profound UI Designer.
ProfoundDesigner.PNG
ProfoundDesigner.PNG (355.87 KiB) Viewed 3019 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: custom widget div value

Post by Scott Klement »

I can only guess at this point (since I cannot debug it), but here is what I would guess;

You will need to either copy the data to an existing bidirectional widget like a hidden textbox, or you will need to manually insert the data into the response object in an onsubmit event.
sfoster
New User
Posts: 5
Joined: Tue Mar 21, 2017 10:44 am
First Name: Sheldon
Last Name: Foster
Company Name: Dealertrack
Contact:

Re: custom widget div value

Post by sfoster »

I've copied the data to an existing bidirectional widget and that is working fine.

You mention inserting the data into the response object. I would prefer to do it that way, if it's possible for rich displays.

Would you be willing to provide an example of how to insert data into the response object?
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: custom widget div value

Post by matt.denninghoff »

To insert data into the response object, you'll need to define a global function with one parameter. For example, you might put this in the same file where you define your custom widget:

Code: Select all

window.myCustomWidgetOnSubmit = function(response){
  var data = {"FMTNAME.FIELDNAME", "somevalue"};
  pui.applyResponse(data, response);
}
Then the "onsubmit" property of the screen would be:

Code: Select all

myCustomWidgetOnSubmit;
Note: there must be no parentheses, and no other code, or else "onsubmit" won't call your function.

The tricky part is knowing what the record format name and bound field name are during runtime.
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: custom widget div value

Post by matt.denninghoff »

Most people use derived widgets to ensure the response is set properly. For custom widgets from scratch, the support for handling the response was limited. With version 5.8.0, we've made it easier. You can read this doc page for details:
http://www.profoundlogic.com/docs/displ ... onse+Value

It was added today.
sfoster
New User
Posts: 5
Joined: Tue Mar 21, 2017 10:44 am
First Name: Sheldon
Last Name: Foster
Company Name: Dealertrack
Contact:

Re: custom widget div value

Post by sfoster »

That's awesome to see it's in the documentation. Thank you so much for your help.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest