Select first item in a lookup dropdown by default
Purpose of this recipe
You have a lookup field in a table. And when adding a new record to the table, you want that field to be set to the first value by default (rather than being empty).
Files to edit
Add the following code to hooks/tablename-dv.js
(where tablename is the name of the concerned table).
If the file doesn’t exist, create it.
|
|
Change tablename
and lookup_fieldname
above to the actual table name and lookup field name.