abhimanu21 wrote:1. I think it is coming as first byte from text "custom-response". Is there is other way to pass the property value then what i am doing?
The string "custom-response" is just a placeholder in the example. You are meant to change that to whatever you want to provide in your variable. So in the case of an indicator field, you'd want to assign either "1" or "0".
Please understand that Profound UI does NOT actually KNOW what you want to send back. That's the point of writing your own code, to make it do whatever you want. So if you want it to contain a "1", you assign a "1". If you want it to contain a "0" you assign a "0". It will do exactly what you tell it to do, so if you assign "custom-response" it will try to put "custom-response" in the variable. (And since the variable is only 1 byte long, only the "c" will fit.)
No, there is not another way to do it.
abhimanu21 wrote:2. Also please suggest how to make this JS logic independent of hard-coded record format name, RPG field name and property name. Do we have to add any logic to custom widget js as well to make it independent of hard coded logic.
abhimanu21 wrote:Tried to use DOM div to get "pui", containing the properties, "fieldName" and "formatName". However i don't see these 2 properties listed there. Am i missng anything? We are at 5.10.0 version.
They were added in 5.8.0, and are in all versions that come after that (including 5.10.0).
If you can't figure out how to get them to work, please post the code that's not working so I can try it.
-------------------------------------------------------------------------------------------------------------------------------- On Submit function:
window.myCustomWidgetOnSubmit = function(response) {
//response["JON.CLICKME"] = $("#fontAwesome1").attr("winresponse");
var widgets = document.querySelectorAll("div[wintest]");
console.log(widgets);
for( var i=0; i < widgets.length; i++){
console.log(widgets.pui); var idVar = widgets.pui.formatName+ "." + widgets.pui.fieldName;
response[idVar]= widgets.getAttribute("winresponse");
}
return true;
}
---------------------------------------------------------------------------------------------------------------------------------------------------
Here i get the error that formatName and fieldName property is not found.
the pui.fieldName and pui.formatName attributes will tell you the field name that is bound to the "value" property. You didn't say, but I'm guessing that you don't have any fields bound to the "value" property, and this is why you're not seeing them.
You are also confusing a profound ui property with a DOM attribute. You are setting "winresponse" as a pui property, but trying to query it as a DOM attribute.
You are also setting winresponse and calling pui.click as a default on the widget settings rather than doing it in the widget itself. Surely that could be confusing when a programmer decides to use your widget and removes that code?
Perhaps you should just forget about the "winresponse" property and use the "value" property that is already available?
I see. My requirement is to have to the same widget multiple times on screen ((different image icons may be for different functionality). Each will have different RPG 'response' field (now 'value' field as you suggested) associated to it.
Just to add to what i was doing, i added 'wintest' to DOM attribute and querying for 'wintest' in DOM. Based on which widget DOM has 'wintest' attribute, i loop through all the widgets on screen and try to assign the 'winresponse' property value to that widgets bound RPG field.
To get the value in 'winresponse' property of clicked widget only, i added applyproperty to change the value in inline js.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Now please suggest the way to resolve this problem where screen has multiple copies of same widget on screen and we need to identify which widget is clicked based on pui.click().
I am not following how do i set the default value to response or value field in widget itself to identify at run time which widget was clicked. i understand it can be done the default way if we are using the widget only once on screen. Please guide.
Requirement is to,
1. Have a property on the widget (either existing or may be new property) where developer can enter some text.
2. The text entered under this property will need to be displayed next to the icon.
3. Entire custom widget and text should be clickable.
Here we are using Font Awesome icons to use as custom widgets. I am not able to figure out how to make this work. Can you please help with this.
Need help with using the widgets on screen. I have created a display file which are using the new widgets. When i use the launch program from designer, widgets are displayed correctly on screen.
However when i run the WEB application and try to open the display file from menu, js files are not loading and widgets are not displayed on screen. I am not sure if we are missing anything .
JS files are stored in htdocs\profoundui\userdata\custom\widgets folder. Please suggest if i need to do any other setup?