Page 1 of 1

Clearing Fields in ProfoundUI

Posted: Wed Jan 08, 2014 6:07 pm
by brianhd71
I'm trying to clear search options in our Bulk Inventory Inquiry. Using changeElementValue() works fine with textboxes, select and combo boxes, checkboxes and dates, but I'm having trouble resetting spinners and radio button groups. Is there a way to reset these widgets to an initial value via javascript?

Re: Clearing Fields in ProfoundUI

Posted: Wed Jan 08, 2014 10:12 pm
by Scott Klement
Hmmm... why not do this in the RPG program? To me, anyway, it's not very intuitive for the display to clear it's own fields. Someone unfamiliar with your display might be reading the RPG code trying to figure out how the program works, and assume these fields never get cleared if the clearing is done in the display.

Having said that, doing it in the display should be possible. It only fails with spinners and radio buttons?

Re: Clearing Fields in ProfoundUI

Posted: Thu Jan 09, 2014 2:58 pm
by brianhd71
As far as I know, only with spinners and radio buttons. I wrote a date function to get a low date so all of our date would pass the filter, and the rest used the changeElementValue function. I suppose I could clear them in the RPG, but why not keep the logic on the client side? When it's an AS400 front end, I do all my clearing and error checking on that front end. And, there must be a way to reset those fields, I just don't know how to yet.

Re: Clearing Fields in ProfoundUI

Posted: Thu Jan 09, 2014 3:32 pm
by Scott Klement
My best guess at this point is that nobody has added support for (spinners, radio buttons) to changeElementValue(), because we didn't think of it, and no customer has asked (until now.)

So your options are:
  • Do it in RPG
  • Use JavaScript to set these values directly (via the DOM) rather than our API. If you do this, you also need to set the widgets 'modified' flag for the value to be sent back to the RPG (this is a peculiarity of PUI)
  • Wait for us to fix changeElementValue(). (This is probably your best option.)
I'm working on another customer's project right now, but I could possibly take a look at updating Profound UI to fix this problem sometime next week. Or I could see if another developer has time.

Re: Clearing Fields in ProfoundUI

Posted: Thu Jan 09, 2014 4:12 pm
by brianhd71
Next week is fine Scott. Thanks!

Re: Clearing Fields in ProfoundUI

Posted: Fri Jan 10, 2014 11:07 pm
by Alex
We looked into this and it appears that changeElementValue() support is there for Spinners and it worked well in a quick test that I had set up. Are you sure it's not working for you? Can you provide an example? Does the first parameter to changeElementValue() match the id of the element exactly (it's case-sensitive).

Radio buttons are not supported by changeElementValue() and there is a reason for this. The values for radio buttons work in groups, yet the first parameter to changeElementValue() is a reference to a specific radio button with its own value, not the group. What's needed is a way to simply specify whether a specific radio button should be set checked or not. Instead of using changeElementValue(), this can should be accomplished with the following simple statement:

Code: Select all

getObj("myradiobutton").checked = true;
This checks the radio button. To uncheck it, use:

Code: Select all

getObj("myradiobutton").checked = false;
Obviously, you should replace "myradionbutton" with the id of your own radio button.

I hope this helps.

Re: Clearing Fields in ProfoundUI

Posted: Wed Jan 15, 2014 3:51 pm
by brianhd71
Alex, setting the radio button property worked.
And, I did get the spinner to zero out. I changed the increment value from 10 to 1.
After that, it worked for incremented values of 1, 2, 4 and 10.
Thank you.