Pre-selecting an existing item

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
SSchimkat
Veteran Member
Posts: 31
Joined: 2018-01-04 18:49

Pre-selecting an existing item

Post by SSchimkat » 2020-01-12 14:37

Hi everyone

Been tweaking my AppGini app quite a loot .. but one thing is still bugging me: I cannot figure out, how to pre-select an item within a dropdown .. that's usually empty, when creating new records.

I need a hint on where to modify the code, for setting temporary defaults, for a specific dropdown - that normally has an empty default.

Anyone? :)

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Pre-selecting an existing item

Post by pbottcher » 2020-01-12 20:19

Hi,

you can try this:

add to the hooks/tablename.php -> tablename_dv function the following:

Code: Select all

if (!$selectedID) {
$html.=<<<EOC
<script>\$j(function() {if (AppGini.current_lookup.value=="") AppGini.current_lookup.value=1});</script>
EOC;
}
replace lookup with the fieldname that have for your lookup field and the 1 with the ID of your pre-selected item.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

SSchimkat
Veteran Member
Posts: 31
Joined: 2018-01-04 18:49

Re: Pre-selecting an existing item

Post by SSchimkat » 2020-01-14 08:22

Thanks .. worked as a charm. :-)

Post Reply