Hi All
I have created a form that lists open jobs with limited info, I would like to add a button that will runs a procedure to update the current job record with the the currently logged in user id then opens another form showing the mor of the job details.
I am ok with creating the button but need some help with the procedure, how do I refer the current record and current user? is there some sample code I could take a look at?
Thanks
Brian ...
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Update Current record
-
- Posts: 6
- Joined: Wed Mar 14, 2018 10:39 am
- Location: UK
- Contact:
Update Current record
You do not have the required permissions to view the files attached to this post.
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: Update Current record
Hi Brian,
Add a procedure (Builders -> Procedure) that looks like this:
Then, when your button is clicked, run this code to execute the PHP procedure:
Add a procedure (Builders -> Procedure) that looks like this:
Code: Select all
$sql = "UPDATE table_name SET user_id = ? WHERE table_name_id = '#record_id#' ";
nuRunQuery($sql, [getnuUserName()]);
function getnuUserName() {
$nuUserObj = nuUser();
if ($nuUserObj == "")
{
$nuUserName = "globeadmin";
} else
{
$nuUserName = $nuUserObj->sus_name;
}
return $nuUserName;
}
$j = "
// open a form, add your parameters here:
nuForm(....); // https://wiki.nubuilder.cloud/index.php/Javascript#nuForm
";
nuJavascriptCallback($j);
Then, when your button is clicked, run this code to execute the PHP procedure:
Code: Select all
nuRunPHPHidden("updateuser", 1);
You do not have the required permissions to view the files attached to this post.
Re: Update Current record
Brian,
As toms showed, you can use Hash Cookies.
https://wiki.nubuilder.cloud/ ... sh_Cookies
You can use nuHash(), inside nuDebug() to find what Hash Cookies are available.
https://wiki.nubuilder.cloud/ ... PHP#nuHash
https://wiki.nubuilder.cloud/ ... HP#nuDebug
Steven
As toms showed, you can use Hash Cookies.
https://wiki.nubuilder.cloud/ ... sh_Cookies
You can use nuHash(), inside nuDebug() to find what Hash Cookies are available.
https://wiki.nubuilder.cloud/ ... PHP#nuHash
https://wiki.nubuilder.cloud/ ... HP#nuDebug
Steven