how to show error on a drop down?

Use this Forum to post your “How to …” questions about your use of aXes. This is not a technical support forum. Both the aXes Support Team at LANSA and other aXes customers may answer your questions. LANSA cannot guarantee the accuracy of any information posted by customers.

Moderator: jeanmichel

Post Reply
gracehsu
Posts: 13
Joined: 23 Dec 2022, 04:06

how to show error on a drop down?

Post by gracehsu »

Hello;

I have started modernizing our green screen programs with AXES, I turned some fields into drop downs and I can't figure out how to reflect the fact that the field is reverse-imaged? (e.g. showing an error)
temp.png
temp.png (7.82 KiB) Viewed 8948 times
User avatar
Dino
Posts: 88
Joined: 19 May 2017, 08:29

Re: how to show error on a drop down?

Post by Dino »

my knowledge in javascript is not that good, but I think the solution will go using something around the properties like this:
(I had been testing using the onSelectedValueChange property of the dropdown to put this code, a better place needs to be found as well)

Code: Select all

alert(FIELD.getProperty("style","color"));
if (FIELD.getProperty("style","color") == "white") 
{
   FIELD.setProperty("dropDownStyle",{"color":"red"});
   FIELD.refresh();
}
I know the setProperty works fine, but the getProperty I am doing something wrong as I cannot retrieve the color, maybe someone here can chime about it.
I have noticed that an input field without error, have the x24i attribute for color, while is x25i for reverse, so the color presented, lets say green or white or anything else, will depend on your aXes styles assigned to them at application level.

just an idea.

https://axesdocs.lansa.com.au/index.php ... 9wZXJ0eSJd
gracehsu
Posts: 13
Joined: 23 Dec 2022, 04:06

Re: how to show error on a drop down?

Post by gracehsu »

figure this out while the forums were down and I'm posting the answer here in case anyone else needs it, I wrote a function in USERENV which I set as a the default for class in all of the extensions (including drop downs)
/*--------------------------------------------------------------------------------------------------------
* check if the 5250 field behind extension is in error, if so, then update css to refled that
* note: apparently, most CSS do not apply to the drop-downs/etc? Luckily if the theme includes rounded
* buttons/dropdowns, you can set the background & border to red.
*--------------------------------------------------------------------------------------------------------*/
e2eCkErr : function(FIELD) {
var X = FIELD.get5250Attribute();
var oStyle = {};

//Check to see if this field's 5250 Attribute Byte is associated with an error message
if ((X == "X25") ||(X == "X28") || (X == "X29") || (X == "X2A") || (X == "X2B")
|| (X == "X2C") || (X == "X2D") || (X == "X2E")) {
oStyle = {"border":"1px solid", "background-color":"#f2dcdb", "color":"#ff0000"};
}
return oStyle;
}, /* <--- Note the comma */

dropdown style:
ENV.returnVal = USERENV.e2eCkErr(FIELD);
Post Reply