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.
Having trouble figuring this one out. I would like to store some API data in an array variable. Then I wan to use a list box to display a list of users from the API call. When the user selects a record in the listbox, then I want to use java to update a text area with the address of that user, by referencing the same ID from the listbox to the ID from the array variable with the addresses.

Thanks for any help, and sorry if this is a repost. I have spent hours trying to find an answer to this.
Please guys, I just need the right syntax for this I have tried every combination I could think of.


none of them provide the value at index 3. In fact they don't return anything at all. Does get value work with an array?

FYI the array is in a hidden field on my form
First of all, you are using JavaScript, not Java.
You can only store strings in a hidden field. If you want to store an array in a hidden field, then you need save it as a JSON string.
Code: Select all
//save array in a hidden field:
var sNumbers = JSON.stringify( ['one', 'two', 'three'] );
$("#myHidden").setValue( sNumbers );
//read from JSON string:
var aNums = JSON.parse( $("#myHidden").getValue() );
//get second element in array
var v = aNums[1];
If you are trying to get the value and text (displayed label) from a selected option in a dropdown box:
var selectedValue = $("#myDropdown").getValue();
var selectedLabel = $("#myDropdown").getText();

If you want to get the third option from a list of available options in a dropdown box:
var thirdOptionValue = $("#myDropdown").getInfo().options[2].value;
var thirdOptionLabel = $("#myDropdown").getInfo().options[2].text;

If you have converted your dropdown into a multiple-selection dropdown (often called a "listbox"), then you can find out if the third option was selected like this:
var isSelected = $("#myDropdown").getControl().prop("options")[2].selected; //will be set to true or false

If you want help with your code, you need to explain what is the type of field for each ID in your code or post the .json file for the Dynaform.
Disable grid using JavaScript

You need to disable the upload button in a Modal[…]


Hello there, We are using PM Enterprise version 3[…]

Detail information, thanks for your sharing.

Don't forget to unblock the core tables: https:/[…]