Hello, friends,
I can’t seem to get select control options to load from a PHP script.
First, here are the DHX libraries I’m using:
[code]
[/code]Here is the ‘select’ control definition from the form’s JSON:
{type: "select", inputWidth: 150, name: "buyers", label: "Buyer", connector: "http://intranet-dev/prBuyers.php"}
And here is the JavaScript code for loading the options:
bForm.reloadOptions("buyers", "http://intranet-dev/prBuyers.php");
The back-end PHP connector code, prBuyers.php, emits this string:
[{text:"Christopher Pike",value:"cpike@abc.org"},{text:"Tiberius Kirk",value:"tkirk@abc.org"}]
But the ‘buyers’ select control options do not get populated. Nothing seems to happen.
However, if I change the JavaScript code to consume a hard-coded string:
bForm.reloadOptions("buyers", [{text:"Christopher Pike",value:"cpike@abc.org"},{text:"Tiberius Kirk",value:"tkirk@abc.org"}]);
… the ‘buyers’ select control options get correctly populated.
Please help me find a solution. I’ve looked into the dhtmlxform_dyn.js extension library code, and the ‘dhtmlXForm.prototype.reloadOptions’ part seems to be getting executed. The value of the ‘name’ argument being passed to it is ‘buyers’, and the value of the ‘data’ argument being passed to it is ‘http://intranet-dev/prBuyers.php’. I assume this is as it should be.
Thank you.
Ajaxian