Getting the value of an error message's error condition variable

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
fcalizo
New User
Posts: 10
Joined: Tue Oct 09, 2018 4:34 pm
First Name: Francis
Last Name: Calizo
Company Name: Banyan Air
Contact:

Getting the value of an error message's error condition variable

Post by fcalizo »

Hi all,

I'm writing some logic that is being all done in the Profound UI Rich Display, not in an RPG Program. I have an error condition (let's call it updateError) within an error message that will fire on a particular element on a page.

Now, on the record format's onLoad() function, I want to check if the variable updateError's value is either 'true' or 'false'. What I have been doing is having to create either a Dynamic Output Field or a Textbox with the value set to updateError and setting the element ID that I can grab using the get() api or document.getElementByID() to get the value of the particular Output field or Textbox.

Is there a way I am able to do this within the Rich Display File without having to put an element on the screen itself?

Thank you.
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: Getting the value of an error message's error condition variable

Post by Scott Klement »

You say you have an error condition stored in a widget named 'updateError' that you are trying to retrieve. You then ask if you can eliminate the screen element. Do you mean you want to eliminate 'updateError'? Or is there some other element involved?

I can't tell you whether you can eliminate updateError since you haven't told me what you're doing in the code aside from retrieving updateError's value. I'd need to know what is currently setting updateError and why.
fcalizo
New User
Posts: 10
Joined: Tue Oct 09, 2018 4:34 pm
First Name: Francis
Last Name: Calizo
Company Name: Banyan Air
Contact:

Re: Getting the value of an error message's error condition variable

Post by fcalizo »

Scott Klement wrote:You say you have an error condition stored in a widget named 'updateError' that you are trying to retrieve. You then ask if you can eliminate the screen element. Do you mean you want to eliminate 'updateError'? Or is there some other element involved?

I can't tell you whether you can eliminate updateError since you haven't told me what you're doing in the code aside from retrieving updateError's value. I'd need to know what is currently setting updateError and why.
So let's say I have an input field. In that particular input field, I have an error message that will fire if that input field is left blank on a page submit, with that error condition being a variable called updateError that is either true or false (I understand I can use the 'required' property in this particular instance, but I'm just using this as an example).

So if I submit the page with that input field blank, the RPG program will check if that input field is blank. If it is, it will give the error condition, updateError, a value of *on/true and return control back to the screen. When the screen has control, I have code written in the record format's onLoad() function that I want to be able to check the value of the error condition variable, updateError, in order to display some text on the screen.

How would I be able to get the value of the variable updateError (i.e either 'true' or 'false')?
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: Getting the value of an error message's error condition variable

Post by Scott Klement »

fcalizo wrote:So if I submit the page with that input field blank, the RPG program will check if that input field is blank. If it is, it will give the error condition, updateError, a value of *on/true and return control back to the screen. When the screen has control, I have code written in the record format's onLoad() function that I want to be able to check the value of the error condition variable, updateError, in order to display some text on the screen.
I thought you said this was all done in the display, and nothing was being done in RPG?! Now you're saying the RPG program will check if the field is blank.

In order to communicate with an RPG program, you're going to need bound variable in the display file's record format. Adding a hidden field such as a textbox or output field is a really simple, easy and flexible way to do that.

But, originally, you said you didn't need to communicate with the RPG program, so I thought you were trying to eliminate the hidden widget. The problem was I didn't know why that widget was there to begin with, or how you could avoid it since I didn't know how it was set. Now you're saying that it's set by an RPG program... well, if it's set by RPG, then yes, you need it. If it's not, then we can certainly look into how to eliminate the extra field.
fcalizo
New User
Posts: 10
Joined: Tue Oct 09, 2018 4:34 pm
First Name: Francis
Last Name: Calizo
Company Name: Banyan Air
Contact:

Re: Getting the value of an error message's error condition variable

Post by fcalizo »

Sorry for the confusion. Your third paragraph answered my question, thank you.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests