Folks,
I have another questions for this group. First off, I have found the link below on adding data to Dropdown Lookup List type field.
In my case, I have my first Lookup Field to be Tournament, then the second Lookup Field is Event. Each Tournament can have multiple Events. Currently, without any initial default value to my Tournament field, if the user chooses a Tournament, the Event Lookup Dropdown field will be dynamically updated to show just the list of Events from the Tournament chosen. This works great without any issue.
However, as soon as I add the following code to my On Add/On Load event to try to default the Tournament initially, my Event drop down becomes empty. It seems like that the AJAX is not firing in this case with my initial default value.
So I did the following to try to use the <FIeld Name>:ui.add() function to add the value. But it keeps erroring out with some kind of generic deluge script message when I starts the Form. So does anyone have any idea on what it may have caused it.
My code:
input.Tournament_Lookup = Tournaments[Current_Default_Tournament].ID;
for each x in Events [Tournament_Lookup == input.Tournament_Lookup] sort by Event_Name
{
Event_Lookup:ui.add(x.Event_Name);
//alert("Event Name: " + x.Event_Name);
}
When I uncommented my alert statement and comment my Event_Lookup:ui.add() line, the alert actually returns me with the proper Event Name based on the default tournament ID setup initially. So I know that this code works up to the Event_Lookup:ui.add() line.
I have also tried to use append() instead of add() and both errors out the same way when the Forms starts up.
Any help will be greatly appreciated. Thanks.