Page 1 of 1
Global Change Indicator
Posted: Tue Nov 06, 2012 2:14 pm
by rmullis
I have a screen that has multiple input fields on it. Also on the screen, there is a tab panel with three tabs each with input fields. Is there a way that I can set an indicator on globally when any of the input fields changes with out having to set on the indicator on each field when it changes?
Re: Global Change Indicator
Posted: Tue Nov 06, 2012 2:20 pm
by Scott Klement
Hi Robert,
There is a "changed" indicator that can be set on at the record-format level. Look for it under the screen properties in your record format.
It will turn on an indicator if any input element in the record has been changed.
- changed.jpg (35.79 KiB) Viewed 1279 times
Re: Global Change Indicator
Posted: Tue Nov 06, 2012 2:55 pm
by rmullis
Thanks Scott. I have looked for that before, but I guess I just missed it.
Re: Global Change Indicator
Posted: Tue Nov 06, 2012 3:02 pm
by rmullis
Scott,
I have a secondary question. I have an "Update" button on this screen. Initially, I want this button to be disabled, until a change to an input field is made. I don't want to return control to my program every time the user changes the value of a field. Is there a way to disable/enable a button without returning to your RPG program every time a field changes to set on an indicator controlling the button's disable property?
Re: Global Change Indicator
Posted: Tue Nov 06, 2012 6:06 pm
by Scott Klement
Sure, you could. My thinking is that you'd want to mark your button as "disabled" in the designer. Then, you'd want to put JavaScript code on each of the input fields in your form (maybe during the "onchange" or "onblur" event) that enables the button when a change is made.
Unfortunately, I don't know a way to do this at the screen-level.
But, you could ctrl-click all of the input fields, and then assign the onchange event to all of them at once. Just set the onchange event to something like:
Code: Select all
getObj("btnUpdate").disabled = false;
The code is off the top of my head, I didn't test it, and I may very well have gotten the property name wrong or some dumb mistsake like that... but hopefully you get the idea... when the onchange JavaScript event fires, it enables the button. when the screen is subsequently redisplayed by RPG, it'll go back to being disabled until a new change is made, etc.
Re: Global Change Indicator
Posted: Wed Nov 07, 2012 11:55 am
by rmullis
Thanks Scott. I will give this a try. I need to get out of the green screen mindset where you define the screen via DDS and everything else is done via the RPG program. Any recommendations on good Javascript for Beginners books?
Re: Global Change Indicator
Posted: Wed Nov 07, 2012 12:27 pm
by Scott Klement
Hi Robert,
Honestly, I don't remember exactly how I learned JavaScript. I asked some colleagues what they thought, and they recommended the free W3Schools web site.
Here's their JavaScript page:
http://w3schools.com/js/default.asp
In my experience, this site is a good place to learn any sort of web-related technology. It's free and has some good getting-started tutorials, plus it provides some pretty good "reference manual" style stuff.
Re: Global Change Indicator
Posted: Thu Jun 06, 2013 1:07 pm
by robhathome2
Hi
Can someone advise if I'm being dim please. Using version 4.5.3.
I'm using the global change indicator but it doesn't seem to be detecting changes to grid fields (it is working fine with the "control record" fields.
I don't want to resort to using js or rpg based checks if I can help it.
Any ideas?
Thanks
Rob.