Is there a way to assign the vale of #nu_user_name# as default value to an attribute field.
Have tried SELECT '#nu_user_name#', But I am getting "#nu_user_name#" as the default value, not "agnar".
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Using #nu_user_name# as default field value
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact:
Re: Using #nu_user_name# as default field value
agnar,
maybe you have already find a solution, otherwise you can define a custom function in Before Open to get user name from DB:
Then, use the JS function where you want; for example, in Javascript tab insert:
Hope this helps,
Max
maybe you have already find a solution, otherwise you can define a custom function in Before Open to get user name from DB:
Code: Select all
$uid = $_SESSION['nu_user_id'];
if ($uid != 'globeadmin') {
$res = db_fetch_object(nuRunQuery("SELECT sus_login_name FROM zzsys_user WHERE zzsys_user_id = '$uid'"));
$username = $res->sus_login_name;
} else {
$username = 'globeadmin';
}
$js = "function getUserName(){return '$username';}";
$this->appendJSfunction($js);
Code: Select all
function nuLoadThis() {
var uname = getUserName();
alert(uname);
// To assign userName to a text object
$( '#my_object_id' ),val( uname );
}
Max