Just taking a quick glance (I did not take the time to code it up or try it) I see two problems with this:
1) You have POSCAT loading earlier than WAREHS.
Since POSCAT needs data from WAREHS, this won't work, since WAREHS hasn't been drawn yet, the call to get() will always be blanks. Use the "Elements" tab to rearrange these, so that POSCAT comes after WAREHS. (Highlight POSCAT and click the button that looks like a down arrow to move it after WAREHS)
2) In WAREHS, you have this:
Code: Select all
applyProperty('POSCAT','choices parameter value', this.value);
applyProperty('POSCAT', 'field type', 'select box');
pui.click();
I don't think you wanted that 'pui.click' in there. You are telling it to do two things simultaneously -- both to reload the POSCAT select box (by applying the field type) and also to submit the screen back to the server-side (RPG? Node?) program. It doesn't make sense to do both of these, you should do only one... either the pui.click() or the applyProperty lines, not both.
I would suggest removing the pui.click().
Result:
Code: Select all
applyProperty('POSCAT','choices parameter value', this.value);
applyProperty('POSCAT', 'field type', 'select box');
3) In POSCAT, you have this in the "onkeypress" event:
First of all, I really question if you want to re-load POSCAT each time someone presses a key on POSCAT. This seems like it would be very confusing and hard for the user to deal with. So please consider whether you truly want to do this.
In the event that you do, there are some problems with this code:
Code: Select all
applyProperty('POSCAT','choices parameter value', WAREHS.value);
applyProperty('POSCAT', 'field type', 'select box');
pui.click()
I don't know what WAREHS.value is meant to be...? Is this that weird thing where sometimes (but unreliably) the browser will automatically load DOM objects into variables that have the same name as their ids? I would strongly discourage you from using that approach. Instead, please use the APIs to retrieve data from the widgets. (Or, if you're really sure the DOM object will suffice, then please retrieve the DOM object in your code rather than expecting the browser to do it for you.) It's not much work and will save you a ton of headaches.
And, just like the previous note, I would remove the pui.click(), it does not make sense to do both the applyProperty and the pui.click().
Result:
Either (a) Right-click the 'onkeypress' property and do "remove property value". Or, (b) if you truly want this behavior where it will reload each time the user presses a key (I don't understand why) then do:
Code: Select all
applyProperty('POSCAT','choices parameter value', pui.get("WAREHS"));
applyProperty('POSCAT', 'field type', 'select box');
4) In POSCAT in the 'onchange' event, you are doing: pui.click()
This might be fine... it depends on what you're trying to accomplish, here.. but this will submit control back to the RPG program when someone changes this dropdown. This doesn't make sense in conjunction with the 'onkeypress' if you still want that to reload the dropdown every time the user presses a key. but, if the 'onkeypress' was a mistake, and you do want the RPG program to run each time the user makes a selection, then this does make sense.