Page 1 of 1

Conditional events?

Posted: Mon Oct 15, 2012 1:49 pm
by Bryan641
I have an application that generated JSON in a file on the IFS, then redisplays the screen. The file name is variable (based on user, job, etc). Provided the creation of the JSON file was successful, when the screen is redisplayed, I'd like to invoke a javascript function, passing in the file name as a parameter, so that function can load the JSON data and act on it.

However, it seems I cannot bind any display format or element events to a program field so that I could set it to "myfunction('filename.json')" for when the page is redisplayed.

I tried searching for ways to do this on the forum but came up empty. I tried placing <script>myfunction('filename.json');</script> in an html container, but apparently it doesn't execute javascript. Also, the amount of data (size of my json file) will exceed the maximum variable size on the display format. Otherwise I could load the data in an html or other container and invoke javascript to pull the field value and act on it.

--Bryan

Re: Conditional events?

Posted: Mon Oct 15, 2012 2:08 pm
by Bryan641
Oh, I think I figured out a way. I could put an output field on the screen with my JSON name, then give it an onload even handler that checks if the value isn't blank, and if not, run my function. I'll give that a try.

--Bryan

Re: Conditional events?

Posted: Mon Oct 15, 2012 5:31 pm
by Scott Klement
Let us know how that works out, Bryan. If it doesn't work, I have some other ideas we could try.