string for select in form

i have i string like

5: “White”, 6: “Yellow”, 7: “Pink”

i need that string view like this

s={5: “White”, 6: “Yellow”, 7: “Pink”};

for attach to select

for (var a in myOpts)
var t = document.createElement(“OPTION”);
t.value = a;

TypeError: Result of expression ‘this.objPull[this.idPrefix+id][method]’ [undefined] is not a function.

[code]var roleData = [
{type: “settings”, position: “label-left”, labelWidth: 50, inputWidth: 80},
{type: “select”, label: “Role”, name: “mySelect”}

var myOpts;
s=("{"+logint.getUserData(id, "role")+"}");
var roleForm = new dhtmlXForm("role", roleData);
var selectObj = roleForm.doWithItem("mySelect", "getSelect");
		for (var x in myOpts) {
				var t = document.createElement("OPTION");
				t.value = x;
		return item.childNodes[1].childNodes[0];

getSelect should be defined before it is called:{
return item.childNodes[1].childNodes[0];

var selectObj = roleForm.doWithItem(“mySelect”, “getSelect”);

ok, working

but not like i figure ;(

how me to empty select box and then init it again with other select option …

i set the event on my tree and then init needed option to selected item on tree :wink:

i need to destroy previously form or just empty list ???

Try the following approach:

var selectObj = roleForm.doWithItem(“mySelect”, “getSelect”);
/clearing of the select/
var opt = roleForm.getOptions(“mySelect”);
opt.length = 0;
/loading of new options/

nothing opt.lengths always = 0

if i init s=("{"+logint.getUserData(id, “role”)+"}"); not by document.createElement(“OPTION”)

may i roleForm._loadOptions(url,selectObj); not from url, load it from string s={1:‘sdfggsg’, 2:‘dfsg’}; ???

sorry my mistake in code …

all working thanks a lot :wink:

and last question

about getOption(“myselect”). need text of selected option

var opts = frm.getOption(“myselect”);
for (var i=0; i<opts.length; i++)
if (opts[i].selected)

TypeError: Result of expression ‘roleForm.getOption’ [undefined] is not a function.

[code]roleForm.attachEvent(“onButtonClick”, function(name,cmd){
if (cmd == “check”)
var opts = roleForm.getOption(“mySelect”);
for (var i=0; i<opts.length; i++)
if (opts[i].selected)



getOptions :wink: