Page 1 of 1

Add controls based upon the data

Posted: Fri Mar 03, 2017 1:44 pm
by Diane
I need to be able to create a screen that is formated depending upon data in a file. It would consist of output text, an input box, then possibly more text and more input boxes. An example would be "Your manifest is approved, but you need to wait " + #### + " hours until you can do whatever". The user sending the message would enter a value where I show the "####". Right now, I'm loading a text area. The text area allows anything to be entered though and would be difficult to validate. The messages could need several fields updated; there really isn't a limit. A message could be "Enter the value for blah" + #### + ", then tell me blah " + ######## + "and also how many blah blah blah? " + ##

Thanks in advance!

Re: Add controls based upon the data

Posted: Fri Mar 03, 2017 1:58 pm
by Scott Klement
This can be done very easily with HTML, like

Code: Select all

Your manifest is approved, but you need to wait <input type="text" id="field1" name="field1"></input> hours until you can do whatever
You could put that into an HTML container (aka "Wrapping Text") widget, for example. You can insert HTML tags whenever you want it to ask for input...

But the tricky part is what to do with the data that was entered. The RPG program will need to know all of the fields in the record format at compile-time since these need to be in the external definition of the display file. Since the field is added dynamically, it won't be there.

I suppose the solution would be to have a bunch of hidden fields that the user doesn't see but are part of the record format, and use JavaScript to copy the values of the dynamic fields to the hidden fields before submitting the result back to the RPG program. Maybe not as simple as you would like... but it'd work.

Re: Add controls based upon the data

Posted: Fri Mar 03, 2017 3:29 pm
by Diane
Scott,

I had thought about using <input> fields, but haven't been using Profound long enough to know how the <form> logic works. Your idea of hidden fields though could work.

Thanks for your help!