combo box field getting text

According to the documentation, the standard calls selectAll() and getSelectedText() are available to all fields. In the case of a COMBOBOX type field, this does not appear to be true. Right now, it throws an exception saying that selectAll() is not a valid function.

I simply call:

elements.orderBy.selectAll()

and I get the exception (orderBy is definitely the combobox, since I can see it set in the debugger as apropriate). I can see that the text value is present in the debugger, but do not know what property to access to get the value.

Given the lack of these functions, I can not see any way to get the currently selected text value (it is not coming from a dataprovider, but a fixed value list) out of the element.

Is there another way to get this value out, or will this be changed?

Jim Olsen

Set the DisplayType property to something other than Calendar, Combobox, Radios, Check, Image_Media and Password and you’ll be able to use selectAll(), replaceSelectedText () and getSelectedText() as desired.

This will not solve the problem if the display type must be Calendar, Combobox, Radios, Check, Image_Media or Password.

John McCann

You are forced, at this point, to use something other than those DisplayTypes I mentioned above.

If that doesn’t solve your issue you might want to post under Feature Requests.

Hi Jim,

What are trying to achieve by this ?

Can you for instance use the getDataProviderValue() function which is under the form->controller node:

//Get a value based on a dataprovider name
var val = controller.getDataProviderValue('combo_field');

This should return the value in the combobox field without having to select and get the selected text

Cheers
Harry

I am trying to get a value that is not data related. In this case, it is for the sort order of the displayed form. I want the user to be able to select this from a list, and not have to take a hit on the database by stuffing this value in the field. I could stuff it in a global, and clutter things up that way as well, and is what I have done temporarily. The current documentation says that I should be able to make these calls on any named field. It is a very logical way to simply get the text value out of a text field for simple form interaction type things.

I can understand Calendar, and odd things like that not supporting this, but an editable combo box can’t be that different than a simple text edit field for this behavior. If nothing else, the documentation should be updated to specifically state that these functions only work with a simple edit, and not all of the other types of fields…