Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

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.
By silviuA
#824322
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.
#824343
Your JavaScript code should work, if your "tex1" field contains the ID of one of your clients.

If you export the Dynaform and post the .json file and export the structure your PM Table and post it, then I will look at it.
#824348
Hi Amos and thanks for the quick reply.
Upon confirmation that the code should work, I investigated a little and found out that the jQuery plugin "select2" was interfering. I deactivated it for this specific control and everything is working as expected (well except for the fact that it is not showing the placeholder's value when nothing is selected, but that's no biggie).
Thanks again!
Cheers,
Silviu

LOOPING A PARALEL TASK I have a loop, inside this[…]

Dear Amos, I want to have some fields of app_cache[…]

One of the annoying problems that are faced by use[…]

Hi, I write a code like this: $("#grid_tes[…]