Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Trap onclick event from Textbox

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
rmassard
Posts: 2
Joined: Thu Feb 23, 2023 10:31 am

Trap onclick event from Textbox

Unread post by rmassard »

Hi there,
I am just about to discover nubuilder and are stuck now because I want to run a procedure by clicking on a field in a browse form. I'm using custom code of the textbox in object view. There is no action, however simple, when clicking on the field.
Can the onclick event be used on a textbox ? Or only buttons ? Or what other type of objects ?
If there is a way, how can I pass a parameter to the PHP procedure (nuRunPhpHiddenWithParameters)
Txs for your help
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Trap onclick event from Textbox

Unread post by kev1n »

nuSelectBrowse() runs when any record on a Browse Form is selected.

And here's a simple example how to use nuRunPHPHiddenWithParams().

In JavaScript:
The function runProc() calls the nuRunPHPHiddenWithParams() function with three arguments:

- 'myproc': a string indicating the name of the PHP procedure to be executed.
- 'myparams': a string representing the a Hash Cookie to be passed to the PHP procedure.
{activity: '111', task: '222'}: an object that contains additional parameters to be passed to the PHP procedure.

Code: Select all

function runProc() {
    nuRunPHPHiddenWithParams('myproc', 'myparams', {
        activity: '111',
        task: 'something'
    });
}
Add a Procedure:
proc.png

Code: Select all

$myparams = nuGetProperty('myparams'); // Retrieve the Hash Cookie

if ($myparams) {

    $myparams = json_decode(base64_decode($myparams)); // Decode it

    $activity = $myparams->activity;  // Retrieve the parameters
    $task = $myparams->task;

    // Output du nuDebug Results
    nuDebug($activity, $task);

}
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Trap onclick event from Textbox

Unread post by kev1n »

Hi,

Could you please let me know if my answer helped and if you were able to get it to work? I would greatly appreciate any feedback you can provide. Thank you!
Post Reply