Showing posts with label dropdown menu. Show all posts
Showing posts with label dropdown menu. Show all posts

Wednesday, May 29, 2013

How do dynamically populate a valcode values for dropdown menu in Web UI or Webadvisor


First, add DYNAMIC.VALCODE.ID to the form

Second, put this in FIELD.ACCEPT of DYNAMIC.VALCODE.ID

* Note: Populate XL.INTERNAL.CODE, XL.DESCRIPTION with the codes and descriptions of the dropdown values first
X.WEB.VALCODE.NUMBER = "PHAM.TEST.CODE"  ß (Notice this has to be the same name as $CR.PHAM.TEST.CODE below)
X.WEB.VALCODE.KEY = ""
CALL S.STORE.DYNAMIC.VALCODES(X.WEB.VALCODE.NUMBER, XL.INTERNAL.CODE, XL.DESCRIPTION,"","",X.WEB.VALCODE.KEY,"","")
INPUT.DATA = X.WEB.VALCODE.KEY


Third, put this in the validation field of the dropdown field.

$CR.PHAM.TEST.CODE;DYNAMIC.VALCODE;DYNAMIC.VALCODES.ID;DYNAMIC.VALCODES.CODES;DYNAMIC.VALCODES.DESCS;DYNAMIC.VALCODES.FLD3;DYNAMIC.VALCODES.FLD4



This subroutine could be useful to modify existing valtable:
S.GET.VALCODE.RECORD

Thursday, May 9, 2013

Submit the form when a drop down menu item is selected in Webadvisor


In field output of a VAR variable, enter the following:

OUTPUT.DATA := '<script type="text/javascript">'
OUTPUT.DATA := "document.getElementById('VAR1').onchange = submit;"
OUTPUT.DATA := 'function submit() {document.datatelform.submit();}'
OUTPUT.DATA := '</script>'

In this case, VAR1 field contains the drop down menu. This code needs to be parsed after VAR1. For instance, if you insert the above code in VAR2 output field, VAR2 needs to be below VAR1 in UI Form Field Sequence.



Note that this has only been tested with standalone webadvisor. I am not sure if this will work with webadvisor webpart inside colleague portal. If it does, the document and field name may need to change accordingly.