Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

On double click

Post Reply
willemgouws99
Posts: 6
Joined: Mon Sep 09, 2013 4:30 pm

On double click

Unread post 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#'
Attachments
workflow approval2.png
workflow approval2.png (55.12 KiB) Viewed 3226 times
willemgouws99
Posts: 6
Joined: Mon Sep 09, 2013 4:30 pm

Re: On double click

Unread post by willemgouws99 »

SolveD !!

Code: Select all

if(this.value==''){this.value = 

zzsys_user_id();

}
worked!! :lol:
only problem is it give the user id instead of the user name :cry:
willemgouws99
Posts: 6
Joined: Mon Sep 09, 2013 4:30 pm

Re: On double click

Unread post by willemgouws99 »

sorry i am such a *noob* :roll:

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

Re: On double click

Unread post by willemgouws99 »

sorry i am such a *noob* :roll:

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:

Re: On double click

Unread post 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
Post Reply