Get Selected text from a form

I have a form with a
{type:‘select’ ,…, connector:‘whatever.php’),

where the connector is the classic key/value pair eg.
countryId : 1
countryName: Italy … etc…

Obviously the underlying db holds the countryId, but the select box shows me the countryName.

As, after saving the form I have to update a grid, how can I set the grid’s cell to the NAME of the country, without having to do another query??

form.getItemValue(‘country’) gives me the country ID
but is there a method such as
form.getItemText(‘country’) to get the TEXT of the select box?

Thanks in advance!


var sel = myForm.getSelect(“country”);
it will give you select DOM elment.

as always, thanks for your help


The above doesn’t work for me. Using ‘formname.getSelect(“op”)’

I get [object HTMLSelectElement] returned.
If I try
rooomfilterAtt3.getSelect(“op”).value, I get ( for example) ‘=’
rooomfilterAtt3.getSelect(“op”).innerHTML, I get

‘is equal tois not equal tois greater thanis less than’

Form content is:
{type: “select”, label: “Operator”, name: “op”, options:[
{text: “is equal to”, value: “=”},
{text: “is not equal to”, value: “<>”},
{text: “is greater than”, value: “>”},
{text: “is less than”, value: “<”}
], tooltip: “Select operator from droplist”, offsetTop: 10, note: { text: “” }},

Any idea why this doesn’t work for me?


var t = myForm.getSelect(name);

you also can get select value using form


may use this code

var t = myForm.getSelect(“SELECT”);
alert( myForm.getItemValue(“SELECT”) + ’ ’ + t.options[t.selectedIndex].text );