Select option in dropdown using JavaScript
Posted: Tue May 07, 2019 3:13 pm
Hi,
I have a dropdown control with the id "dropdown1" which is populated from a processmaker table using a sql query like : SELECT client_id, concat(client_name, ' ', client_lastname) FROM PMT_CLIENTS.
In a different text control, with the id "tex1", I obtain the client_id value from the database.
What I want is to use javascript to select the client in "dropdown1" based of the value of "text1".
I tried using :
$("#dropdown1").setValue($("#tex1").getValue());
but is not working, the dropdown1 shows the placeholder, not the client data.
It must be a simple matter because I did not find anything related on the forum or in the wiki, but I just don't know how to solve it. I would appreciate any idea you may have. Thanks.
As an extra info, I'm using Processmaker 3.2.1-community, and my JS skill is kinda low.
I have a dropdown control with the id "dropdown1" which is populated from a processmaker table using a sql query like : SELECT client_id, concat(client_name, ' ', client_lastname) FROM PMT_CLIENTS.
In a different text control, with the id "tex1", I obtain the client_id value from the database.
What I want is to use javascript to select the client in "dropdown1" based of the value of "text1".
I tried using :
$("#dropdown1").setValue($("#tex1").getValue());
but is not working, the dropdown1 shows the placeholder, not the client data.
It must be a simple matter because I did not find anything related on the forum or in the wiki, but I just don't know how to solve it. I would appreciate any idea you may have. Thanks.
As an extra info, I'm using Processmaker 3.2.1-community, and my JS skill is kinda low.