Default a field to the logged in user

I have an ‘Add’ form for a subsidiary table where one field is ‘user_id’ which is set as a ‘Select’ tag and uses the ‘members’ table as a lookup so you can pick a name from the drop-down list.
That works fine, but how can I get this to default to the logged in user? i.e. the Select field displays the name and the underlying user id is the field saved.Thanks
S

You may put this code in “Row_Rendered” server event:if ( (CurrentPageID() == “add” || CurrentPageID() == “edit”) && IsLoggedIn() ) {
$this->user_id->CurrentValue = CurrentUserID(); // assume your “user_id” field will store the current user id and it has been setup from Advanced Security setting
}You may also put this code in “Row_Inserting” and “Row_Updating” server event (if necessary):$rsnew[“user_id”] = CurrentUserID();

Many thanks