I saw couple of posts on this topic using Javascript but did not find the solution I am looking for.
Dropdown is in a collection, dropdown will be populated from database. How do we default to the first value returned?
I saw couple of posts on this topic using Javascript but did not find the solution I am looking for.
Dropdown is in a collection, dropdown will be populated from database. How do we default to the first value returned?
okay im assuming that you set your look up rule to fill always and you dont put anything in default.. i would use the onlookupcompleted function to then set the default value of your dropdown.
keep in mind that you will probably have to use for each ("Your Collection") and $(this).find("your dropdown name").select
the selct function will let you set the defualt .. here is example link
https://answers.laserfiche.com/questions/156804/Set-value-in-drop-down-list-with-Javascript
ORRRRRR
use the foobar default logic built into forms:
i havent confirmed this myself but seems reasonable for it to still work.
$(document).on("lookupcomplete", function(){
console.log("look up complete.. start the parent item for dropdown");
var item = $('select[id=Field40] option:nth-child(2)').text()
$('[id=Field40]').val(item).change();
});
this is better and a full code of it. just change the field to your drop down. maybe put a filter for which look up finished so you dont interrupt things as you continue to build.
note to self.