Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
willemgouws99
Posts: 6 Joined: Mon Sep 09, 2013 4:30 pm
Unread post
by willemgouws99 » Mon Sep 09, 2013 4:43 pm
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#'
You do not have the required permissions to view the files attached to this post.
willemgouws99
Posts: 6 Joined: Mon Sep 09, 2013 4:30 pm
Unread post
by willemgouws99 » Tue Sep 10, 2013 10:37 am
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
willemgouws99
Posts: 6 Joined: Mon Sep 09, 2013 4:30 pm
Unread post
by willemgouws99 » Wed Sep 11, 2013 5:34 pm
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;
}
willemgouws99
Posts: 6 Joined: Mon Sep 09, 2013 4:30 pm
Unread post
by willemgouws99 » Wed Sep 11, 2013 6:22 pm
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;
}
massiws
Posts: 503 Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:
Unread post
by massiws » Sat Sep 14, 2013 11:39 am
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