Miscellaneous Response object issues and custom widgets

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
shelfos
New User
Posts: 5
Joined: Mon Oct 31, 2016 5:01 pm
First Name: Sheldon
Last Name: Foster
Company Name: DT
City: South Jordan
State / Province: Utah
Zip / Postal Code: 84095
Country: United States
Contact:

Miscellaneous Response object issues and custom widgets

Post by shelfos »

I have two issues related to custom widgets and sending back a response to the IBM i.
  • Issue 1:
    • Scenario: Using more than one kind of custom widget in the same record format requiring multiple functions in the onsubmit() event.
    • Example:

      Code: Select all

      window.myCustomWidgetOnSubmit1; window.myCustomWidgetOnSubmit2;
    • Problem: The first function is evaluated; the second one is not.
    • Potential Solutions:
      • 1. Use the same function for all custom widget types (append code to this function whenever a new widget type is created)
      • 2. Expose the response object so that values can be appended directly to it from within the custom widget's code (removing the need to call a function in the onsubmit() event that handles it)
      • 3. Expose a custom response object that gets appended to the main response object on form submission (custom widget code would include assignments to this custom response object)
      • (ProfoundLogic would have to enhance their code for solutions 2 and 3)
  • Issue 2:
    • Scenario: Using pui.submit() in the onclick event of a custom widget (where the onclick event is attached in the custom widget code itself)
    • Problem: pui.submit() does indeed submit the form, but when done this way seems to bypass calling any custom widget functions listed in the onsubmit() event of the record format itself.
    • Hopefully someone has some ideas how to solve this issue.
Thanks!
Last edited by shelfos on Tue Jul 11, 2017 12:00 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: Miscellaneous Response object issues and custom widgets

Post by Scott Klement »

Right now, you will need to use a single function for onsubmit. It is possible to write a generic one that will work with any/all custom widgets on the display without changes when more custom widgets are added/removed. There is an example of this in the documentation.

PLEASE, never modify the profound ui runtime code. Not only would this require you to make changes each time you upgrade or install a patch, but it'd also make it nearly impossible for us to support you.

pui.submit() is ONLY for when you are not using our displays, but instead driving your own custom HTML with the open access handler, or for handling offline situations in mobile apps. You should not be using it in a Rich Display like this. Please use pui.click() to submit displays.
shelfos
New User
Posts: 5
Joined: Mon Oct 31, 2016 5:01 pm
First Name: Sheldon
Last Name: Foster
Company Name: DT
City: South Jordan
State / Province: Utah
Zip / Postal Code: 84095
Country: United States
Contact:

Re: Miscellaneous Response object issues and custom widgets

Post by shelfos »

Scott,

Would you and others at Profound consider the option of having a custom Response object available to append values to, for merging with the main Response object? It would be nice to encapsulate the functionality for each custom widget without having to worry about calling a function on the onsubmit() event. This would shield future designers/developers from having to always remember that.

I don't think it would be terribly difficult to accomplish. An object could be created at runtime, something like:

Code: Select all

var customWidgetResponses = {}; 

Custom widget developers would have to add values to this object in the custom widget's code, e.g.

Code: Select all

customWidgetResponses["RECF0001.FLD0001"] = "some value";
Upon form submission, Profound would merge any values in the customWidgetResponses object with any main response values.
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: Miscellaneous Response object issues and custom widgets

Post by Scott Klement »

If you want to place a feature request, you can do so my e-mailing support@profoundlogic.com
shelfos
New User
Posts: 5
Joined: Mon Oct 31, 2016 5:01 pm
First Name: Sheldon
Last Name: Foster
Company Name: DT
City: South Jordan
State / Province: Utah
Zip / Postal Code: 84095
Country: United States
Contact:

Re: Miscellaneous Response object issues and custom widgets

Post by shelfos »

I just now submitted this feature request to support@profoundlogic.com

Thank you.
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: Miscellaneous Response object issues and custom widgets

Post by matt.denninghoff »

This has long been in the works, but we've implemented a way for users to create custom widgets that are treated like native Profound UI widgets: their values get submitted to the server-side program (including when they are in subfiles), and they work with most Profound UI widget API methods.

The feature will be available with the next release of Profound UI, Version 6 Fix Pack 12.0.

Please see the documentation page about pui.BasicWidget for the specifications and an example: https://docs.profoundlogic.com/x/UgFKB

Using this class vastly simplifies the implementation of custom widgets; there's no more need to code "onload" code or "beforeSubmit". Values get formatted automatically according to their bound date type and formatting options. Values are automatically applied to the correct format, so there's no more need to divine the format name from the screen.

Widgets from 3rd party frameworks can be wrapped in instances of pui.BasicWidget, allowing them to be used like native Profound UI widgets.

I hope you find this useful!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests