Change the value of the field with Dynamic List

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

azaleas
Ebase User
Posts: 81
Joined: Thu Jul 30, 2015 12:44 pm

Change the value of the field with Dynamic List

#1

Postby azaleas » Sun Aug 16, 2015 1:14 pm

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?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Mon Aug 17, 2015 9:34 am

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

azaleas
Ebase User
Posts: 81
Joined: Thu Jul 30, 2015 12:44 pm

#3

Postby azaleas » Mon Aug 17, 2015 10:26 am

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);
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.

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

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Mon Aug 17, 2015 1:17 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:

Code: Select all

log("Current row is: " + tables.TABLENAME.currentRow);
A value of -1 means that the current row is not set, 0 means the first row.
0 x

azaleas
Ebase User
Posts: 81
Joined: Thu Jul 30, 2015 12:44 pm

#5

Postby azaleas » Wed Aug 19, 2015 7:19 am

Ok, I just had a problem with mapping the fields. Sorry..

Thanks for the help.
0 x


Who is online

Users browsing this forum: Bing [Bot] and 8 guests