I need to get the value of a selected option of a richselect element.
The getValues() method only gets the ID of the option. Is there a way to get the actual value of the option instead of the ID?
There’s a getText() method that gets visible text of richselect option.
Thanks for the info!
What would be the best way to do this when getting form data? At the moment I am just doing form.getValues(). The form contains text boxes and richselects, would I need to get each element separately?
Thinking, could I not just set the ID to the value instead?
Here you can go two ways:
-
If there’re more text boxes than select inputs in your form, get form values as a whole with the getValues() method and then redefine the needed fields.
-
or use a custom function to get form values, applying getText() method to those controls that possess it.
Yes, you may as well use the same id and value for a richselect option, but keep in mind that ID parameter should be unique within the options collection.
Thats great, thank you very much for your help! And quick replies too!