Page 1 of 1
On double click
Posted: Mon Sep 09, 2013 4:43 pm
by willemgouws99
Hi
I would like to update a field with the current username and date when the user simply double clicks on the flied
how do I do this with
On Double Click
Field name:
user1
date1
for eg: in the On Focus is used
Code: Select all
if(this.value==''){this.value =
'SELECT ' +
' \'#zzsys_user_id#\'';
}
but the SQL does not execute it just populates the value SELECT '#zzsys_user_id#'
Re: On double click
Posted: Tue Sep 10, 2013 10:37 am
by willemgouws99
SolveD !!
Code: Select all
if(this.value==''){this.value =
zzsys_user_id();
}
worked!!
only problem is it give the user id instead of the user name
Re: On double click
Posted: Wed Sep 11, 2013 5:34 pm
by willemgouws99
sorry i am such a *noob*
How do I do a SQL inside the
Code: Select all
if(this.value==''){this.value =
$user=zzsys_user_id();
NEED HELP here!!!
"SELECT sus_name FROM zzsys_user WHERE zzsys_user_id = $user;
}
Re: On double click
Posted: Wed Sep 11, 2013 6:22 pm
by willemgouws99
sorry i am such a *noob*
How do I do a SQL inside the
Code: Select all
if(this.value==''){this.value =
$user=zzsys_user_id();
NEED HELP here!!!
"SELECT sus_name FROM zzsys_user WHERE zzsys_user_id = $user;
}
Re: On double click
Posted: Sat Sep 14, 2013 11:39 am
by massiws
willemgouws99,
add this code in
Custom code > Before Open:
Code: Select all
$userID = '#zzsys_user_id#';
if ($userID == 'globeadmin') {
$userName = 'globeadmin';
} else {
$sql = "SELECT sus_name FROM zzsys_user WHERE zzsys_user_id = '$userID'";
$user = db_fetch_object(nuRunQuery($sql));
$userName = $user->sus_name;
}
$js = "function getUsername() {
return '$userName';
}";
addJSFunction($js);
then, in
On Double Click field of your object insert this:
Code: Select all
if (this.value == '') {
this.value = getUsername();
}
Max