Page 1 of 1

Can't seem to use FIELDS to find a default visualization input field

Posted: 18 Nov 2023, 05:56
by gracehsu
I can't seem to get FIELDS() to work consistently with a default visualization I added to a screen.

Example below is a test I set up just to see what I'm doing wrong :
1. I named the command line for the menu to "cmd_Line".
2. I added a default Visualization I called "io_Test"
- note: I copy-pasted this name in the script to make sure I'm not fatfingering
Screenshot_axes_example_01.gif
Screenshot_axes_example_01.gif (209.54 KiB) Viewed 20263 times
3. I added a button into which I put the following script onClick:
alert("io_Test=" +FIELDS("io_Test").getValue()+'\n' +'cmd_Line: '+FIELDS("cmd_Line").getValue());
FIELDS("io_Test").setValue("foo");
FIELDS("cmd_Line").setValue("foo");
4. Tests:
a. click button with both fields blank, both io_Test & cmd_Line were correctly filled with the text "foo"
b. fill io_Test with "default value" & cmd_Line with "something I typed":
The attachment Screenshot_axes_example_02.gif is no longer available

Re: Can't seem to use FIELDS to find a default visualization input field

Posted: 22 Nov 2023, 00:57
by Fre_Vdh
Are you sure that the name of the command line field is "cmd_Line"?

I tried the same as you did (and copied your code).

First time I get an "empty" alert:
1.png
1.png (64.89 KiB) Viewed 20249 times
.

Then both fields are set to "foo".
Clicking the button again gives me the correct alert:
2.png
2.png (59.56 KiB) Viewed 20249 times