Hey friends, im working with some JS library on my process and it works, for use my .js I added a HTML widget and wrote the javascript code.
The javascript code is on a constant expression, but it needs an arrayList to run, when I use a static arraylist like this, is working ok :
var numbers=[50,14,7,8];
but now i need to get that numbers of my Global process variable (ArrayList), i added some listWiget to try this:
document.getElementById(“ListWidget”).value ;
but it not works.
somebody knows how to get global ArrayList variable values on my Constant Expressión.
thanks in advance.
Hi.
I don’t think you can use directly your list in a Constant Expression.
But you can use your list by using a script.
This script will return your HTML/JS code.
For example, if my list is “processList”, I can use this script :
return “
”+processList.toString()+“
”;
Another example where I display my list in a html table :
String script = “
”;
for (int x : processList) {
script += “
”;
}
script += “
”;
return script;
Hey @yannick.lombardi thanks for u answer, it works great .
But that I really need is to get the list value with javaScript using the widget list.value, I was trying to do this first with a simple text Field like this:
The textField Contains a default value : “Rene” But this don’t works for me, the alert just say : undefined value, i did it in a alone .HTML and it works great, i dont know why I can take the value by the id TexField on my PageTemplate.
finally i use the option Use layout generate template to put directly the Script Code on the HTML code. If i create a static div like this :
the alert works OK, I use 3 **div ** and .lastChild cuase bonita create 3 this the Bonita WebForm running:
I hope you can help me to get the value of this texField i really dont understand why it dont works.
Note : im not using the JavaScrip editor, cause when I use a .JS library it contains may reserved words that the validator don´t recognized it. Is for that I put the directly on the HTML Form, the problem is not the javaScript as i mention before if i use static values it runs ok, but i need the values of the variables that are in the widget values of my form.
Thanks and advance.
If you want to read the selected value in your Select Field, you can add an id in the “Options” tab of your field. After that, you can get the field with “document.getElementById”.
For example, I have a TextField, I add : id=“text” in the options tab.
Then I run the process, and I use the javascript code : document.getElementById(‘text’).value. It returns the content of the field.