Latest version of the (failing) script. I now get an error message "select_control[0] is undefined". It may be to do with the fact that I am running the rule on loading the form...? But how else do I get it to execute and populate the dropdwn list?
var el = document.createElement('option');
html = "<option value='Woohoo'>Woohoo</option>";
el.innerHTML = html;
var cocode = document.getElementById('frm_component_select1_1');
cocode.add(el);
$form.reloadDropDownOptions('/my:myFields/my:CompanyCodes');
------------------------------
Jurgen Lootens | Consultant
CTAC | 0123456789
------------------------------
Original Message:
Sent: 07-16-2019 10:23
From: Jurgen Lootens
Subject: Javascript to populate a dropdown list
I'm getting the message in the debugger that the function add is not valid.
Does anyone know how to write this script?
------------------------------
Jurgen Lootens | Consultant
CTAC | 0123456789
Original Message:
Sent: 07-16-2019 10:05
From: Jurgen Lootens
Subject: Javascript to populate a dropdown list
I have written a javascript but it does not do what I need it to. Can someone please tell me what is wrong with it and how to correct it?
var CompanyCodes = document.getElementsByTagName('CompanyCodes');
var el = document.createElement("option");
el.text = 'Woohoo';
el.value = 'Woohoo';
CompanyCodes.add(el);
$form.reloadDropDownOptions('/my:myFields/my:CompanyCodes');
------------------------------
Jurgen Lootens | Consultant
CTAC | 0123456789
------------------------------