The lookupcombo is the key field. On exit of the field, I normally check the database if the key field exists In case it exists then the data is available for editing else a new record is appended so that the user can add the new record.
Client event
function OnBlur(sender)
{
ajaxRequest(sender,'checkuserid',['muserid='+Fmusermas.muserid.getValue()]);
}
The Ajax Event
procedure TFmusermas.museridAjaxEvent(Sender: TComponent; EventName: string;
Params: TStrings);
var muserid:string ;
ps:integer;
begin
if EventName = 'checkuserid' then
begin
muserid:= Params.Values['muserid'];
ps:= pos('-',muserid);
if ps > 0 then
muserid := trim(copy(muserid,1,ps-1));
CheckUserID(muserid);
end;
end;
Currently I have resolved the issue by checking for the '-' and extracting the key field.