Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#788912
I need to use javascript to grab the selected dropdown value and add it to a textbox so it can be edited.

How can I use javascript to move the selected text from a dropdown to a text box.

This code won't work:
Code: Select all
  $("#textbox001").setValue($("#dropdown001").getText()); 
I thought it would work but it keeps returning the label of the dropdown box as if I were doing this:
Code: Select all
  $("#textbox001").setValue($("#dropdown001").getLabel()); 
Any suggestions?
#788915
Thanks so much for the suggestion. I really appreciate all your help.

That's actually what I started with but it adds the key of the dropdown instead of the text(label) from the dropdown box.

I can't seem to get this to work at all. Is there a work around? Any thoughts?
#788920
Hello,

To achieve this you may add the following code to your javascript:
Code: Select all
$("#dd1").getControl().change(function(){
  var i = this.value;
  var val = this.options[i-1].label;
  $("#tb1").setValue(val);
});
where, dd1 is the ID for the dropdown and tb1 is the ID for the text field.

Hope this helps.
#788927
Ok, must have messed up and am super sorry. I really did check this over multiple times before posting and asking for help.

Apparently I must have made some error with my code because now it is working.

So FYI, this works fine (as it should):
Code: Select all
$("#textbox001").setValue($("#dropdown001").getText());
Wish I could tell you where I went wrong but I don't know what I did to fix it.

Am I the only one that that happens to?

Being the best in the started business is the obje[…]

Winzo is a popular and unique game on the mobile p[…]

Cannot create process using templets

Real details. The problem was solved by effect!

However, it is essential to use it responsibly and[…]