http://www.profoundlogic.com/docs/displ ... ipt+Coding
Using the stuff I posted as an example:
Code: Select all
1: var choices = ["-- Select --"];
2: var values = ["-"];
3: for (var row=2; row<=11; row++) {
4: var elem = "D_" + row + "_7";
5: var resp = "I_" + row + "_5";
6: choices.push(get(elem));
7: values.push(resp);
8: hideElements(elem, resp);
}
9:applyProperty("myDropdown", "choices", JSON.stringify(choices));
10:applyProperty("myDropdown", "choice values", JSON.stringify(values));
Lines 1 & 2 in the code above are normal JavaScript declarations for an array. They put "-- Select --" as the first array element for the choices, and "-" as the first array element for the values. So nothing profound-specific here.
Line 3 is a normal JavaScript for loop. Loops from 2-11.. nothing profound-specific.
Lines 4 & 5 are just building strings to identify the fields we want. So normal string concatenation to build the ID in the format specific to Genie.
Line 6 calls the Profound get() API to retrieve the value of the display field. It then pushes it onto the end of the array. 'push' is standard JavaScript, but the get() call is Profound-specific, and documented here: http://www.profoundlogic.com/docs/displ ... %28+id+%29
Line 7 is standard JS, just pushes a string onto the array.
line 8 is a Profound-specific API to hide elements on the screen. We pass the two IDs (I_row_5 and D_row_7) into it, and it will hide them. This is documented here: http://www.profoundlogic.com/docs/displ ... etc...+%29
lines 9 & 10 use the applyProperty() API, which is a Profound-specific API to change a property of a widget programmatically. They convert the arrays into JSON text using the standard JavaScript JSON.stringify() routine, and then apply this as the 'choices' or 'choice values' properties of the dropdown (just like you can do by hand if you go into the widget properties in the designer.) The applyProperty() API can be found here: http://www.profoundlogic.com/docs/displ ... opValue%29
Here's the other piece of code:
Code: Select all
1: var resp = get(this);
2: if (resp != "-") {
3: changeElementValue(resp, "1");
4: pressKey("Enter");
}
Line 2: standard Javascript 'if' statement. If the user selected the choice in the dropdown that said "--Select--" the value will be "-", so they haven't selected anything and therefore we shouldn't do anything if the value is "-".
Line 3: changeElementValue() is a profound-specific API to change the value of a widget. In this case, putting a "1" into the underlying green-screen input field (I_row_5) that was hidden earlier. changeElementValue() is documented here: http://www.profoundlogic.com/docs/displ ... +value+%29
Line 4: pressKey() is a genie-specific API that acts like the user pressed one of the 5250 keys that submit a screen (Enter, PageUp/PageDown, F-keys, etc). In this case, pressing Enter to submit the screen. pressKey() is documented here: http://www.profoundlogic.com/docs/displ ... 28+key+%29
Does that help?