Field uses dropdown display type, dynamic list to choose the value.
How to change the value of that field using the JS.
For example:
I got the tables.DROPDOWNFIELDNAME.value = "NewValue";
The value is copied, I can see that with log. But on the form, the field is still saying "Please Select". How to change it so that it will show the NewValue?
This doesn't happen with Static list.
Any help?
Change the value of the field with Dynamic List
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
It sounds like "NewValue" doesn't exist in the list - as fetched from the database. For Dynamic Lists, the system will remove a value if it's not in the list. If you don't want this behaviour, you should use a custom list and populate it using your own SQL. Then you can do whatever you want. You can build a custom list with.
Code: Select all
tables.DROPDOWNFIELDNAME.createCustomList(array_of_list_values);
0 x
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
New Value exists in the list. I checked via Log File. It all matches and I see the value in the log. But I can't see the value in the field.Jon wrote:It sounds like "NewValue" doesn't exist in the list - as fetched from the database. For Dynamic Lists, the system will remove a value if it's not in the list. If you don't want this behaviour, you should use a custom list and populate it using your own SQL. Then you can do whatever you want. You can build a custom list with.
Code: Select all
tables.DROPDOWNFIELDNAME.createCustomList(array_of_list_values);
I did this trick with regular fields, and it worked just fine. But this time the field is Table column. And it won't show anything, just "Please select", even though the value is assigned.
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
You mean just "Please Select" and no drop down list entries? If that is the case, the list hasn't been built or the list SQL is not returning any rows. Make sure the When list is built field property is not set to "Never". You should see a message in the log saying the list is being built - this occurs after any scripts have run.
Another possibility is that the table's current row is not set when you assign the value. The statement tables.TABLENAME.DROPDOWNFIELDNAME.value = "NewValue" means assign the value to the DROPDOWNFIELDNAME column on the current row. If the statement is issued when the table is empty, there is no current row (see documentation for a discussion of current row). There were also some bugs in this area that were fixed in V4.5.3. You can check the current row with:
A value of -1 means that the current row is not set, 0 means the first row.
Another possibility is that the table's current row is not set when you assign the value. The statement tables.TABLENAME.DROPDOWNFIELDNAME.value = "NewValue" means assign the value to the DROPDOWNFIELDNAME column on the current row. If the statement is issued when the table is empty, there is no current row (see documentation for a discussion of current row). There were also some bugs in this area that were fixed in V4.5.3. You can check the current row with:
Code: Select all
log("Current row is: " + tables.TABLENAME.currentRow);
0 x
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
Who is online
Users browsing this forum: Bing [Bot] and 8 guests