ProcessMaker code contributions

Moderator: amosbatto

By sabinsunny
#790009
Hi Team, Today i need a java script

i have a dropdown list and and a textbox;
i need to display the value in textbox which i select in the dropdown list.
User avatar
By amosbatto
#790012
Do you want the value of the selected option in the dropdown or its label?

To copy the value of the selected option, do this:
Code: Select all
$("#mydropdown").setOnchange( function (newVal, oldVal) {
    $("#mytextbox").setValue(newVal);
});
If you need the label of the selected option, then do this:
Code: Select all
$("#mydropdown").setOnchange( function (newVal, oldVal) {
    var aOptions = $("#mydropdown").getInfo().options;
    for (var i in aOptions) {
        if (aOptions[i].value == newVal) {
            $("#mytextbox").setValue(aOptions[i].label);
            break;
        } 
    }        
});
Where "mydropdown" is the ID of your dropdown and "mytextbox" is the ID of your textbox.
Import this DynaForm for an example:
(2.31 KiB) Downloaded 112 times
By sabinsunny
#790020
Hi amosbatto ,
Thank You So Much,

Here i need another coding also

need to take substring from one dropdown box value to another textbox
Attachments
string.png
string.png (1.08 KiB) Viewed 3039 times
DropBox.png
dropdownn box
DropBox.png (3.57 KiB) Viewed 3039 times
By mishika
#790022
Hello,

To add a substring to another text box, you can make a little modification to the code given by Amos.
Code can be as follows:
Code: Select all
$("#mydropdown").setOnchange( function (newVal, oldVal) {
  var aOptions = $("#mydropdown").getInfo().options;
  for (var i in aOptions) {
    if (aOptions[i].value == newVal) {
      $("#mytextbox").setValue(aOptions[i].label);
      var lab = aOptions[i].label;	//take the label
      var res = lab.split("-");		//split and get an array
      $("#mytextbox1").setValue(res[1]); 	//assign a value from array to a textbox
      break;
    }
  } 
});
You can use .split function to break the string on the basis of a connector like -, ., _ etc.
You can also use .substring function where you will have to pass the starting index and the ending index of the string to be selected from the main string.

Hope this helps

Best Regards
Mishika
Pasar desde una PM table a Grid

He creado un ejemplo que puedes usar: https://www.[…]

Starting subprocess

See: https://www.pmusers.com/index.php/Executing_a[…]

error when I restart my server

Hi Amos, I flaged the debug=1 but the errors are […]

If you press F12 to open the web browser's debugge[…]