cancel
Showing results for 
Search instead for 
Did you mean: 

How to get selected value in dropdown field by javascript?

sprincess
Champ in-the-making
Champ in-the-making

Hi all,

I can use javascript to change the dropdown field value:

scope.findFormFieldWithId(scope.allFormFields,'quantity').value=scope.findFormFieldWithId(scope.allFormFields, 'quantity').options[3];

I am finding the way to get the user selected value from the dropdown field, something should be like:

scope.findFormFieldWithId(scope.allFormFields, 'quantity').selectedValue;

how can I achieve this in the code?
Many thanks!

BR,
Mandy

1 ACCEPTED ANSWER

gdharley
Elite Collaborator
Elite Collaborator

Did you try:

var thisUn1 = scope.findFormFieldWithId(scope.allFormFields, 'label1').value.id;

or

var thisUn1 = scope.findFormFieldWithId(scope.allFormFields, 'label1').value.name;

Thanks,
Greg

View answer in original post

3 REPLIES 3

gdharley
Elite Collaborator
Elite Collaborator

Did you try:

var thisUn1 = scope.findFormFieldWithId(scope.allFormFields, 'label1').value.id;

or

var thisUn1 = scope.findFormFieldWithId(scope.allFormFields, 'label1').value.name;

Thanks,
Greg

sprincess
Champ in-the-making
Champ in-the-making

Thanks for your kindly help.

The code is working greatly!

But I wonder to know how can I know the information of ".value.id" and ".value.name" for the other components?

Could you let me know where I can find the reference? thanks a lot!

BR,

Mandy

gdharley
Elite Collaborator
Elite Collaborator

No docs on this, had to work it out by crawling through source.

Greg