nuRunHiddenPHP

Questions related to using nuBuilder Forte.

nuRunHiddenPHP

Postby alf1976 » Wed Feb 21, 2018 5:28 am

In the javascript on the form i have the following code
Code: Select all
var operationdata = 0;
nuSetProperty('GetOperationID', '6');  // set hash for php function
nuRunPHPHidden('GetOperationInfo', 1); //load data as JSON string and load into operationdata
console.log('Data: ',operationdata);
UpdateOrientation(); // updated orientation display field
UpdateSubCompOpacity(); // update opacity on new subform row.
UpdateComponentQty(); // relculate subform costs.



The PHP procedure has a java script callback which is
Code: Select all
$js = "
    operationdata = $result;
    ";


The callback does populate the operationdata with the information but not until (it appears) the entire javascript for the form has run.
So by the time it has received the data all the caculations have finished.

Is there away to process the java script on the callback as soon as the nuRunPHPHidden() has run - ie before the next statement?

Or is there a better way to achieve the above.
alf1976
 
Posts: 75
Joined: Wed Dec 27, 2017 5:28 am

Re: nuRunHiddenPHP

Postby admin » Wed Feb 21, 2018 6:30 am

Andrew,

If I understand you.

You could move your Update functions to the callback.

Code: Select all

var operationdata = 0;

nuSetProperty('GetOperationID', '6');
nuRunPHPHidden('GetOperationInfo', 1);



Code: Select all

$js = "

    operationdata = $result;

    UpdateOrientation(); // updated orientation display field
    UpdateSubCompOpacity(); // update opacity on new subform row.
    UpdateComponentQty(); // relculate subform costs.

    console.log('Updates done!');

    ";




Steven
admin
Site Admin
 
Posts: 3289
Joined: Mon Jun 15, 2009 9:53 am

Re: nuRunHiddenPHP

Postby alf1976 » Wed Feb 21, 2018 6:44 am

thanks for the advice. that should change the execution order
i'll give it a try.
alf1976
 
Posts: 75
Joined: Wed Dec 27, 2017 5:28 am

Re: nuRunHiddenPHP

Postby admin » Wed Feb 21, 2018 8:10 am

.
admin
Site Admin
 
Posts: 3289
Joined: Mon Jun 15, 2009 9:53 am


Return to General