nuuserhome Custom Code Removed on Upgrade

Questions related to installing, setting up and configuring nuBuilder Forte

nuuserhome Custom Code Removed on Upgrade

Unread postby pmjd » Sat Jul 24, 2021 1:38 am

Hello,

Not sure if this is a bug or by design but each time I update to newer version of nuBuilder 4.5 the JS code I have in the nuuserhome Custom Code area is always removed and replaced by the default code.
Code: Select all
function openNuObject() {

    $('#nuMessageDiv').remove();
    nuPopup('nuobject', '-1', window.nuFORM.getCurrent().form_id, '', 0);

}

if (nuSERVERRESPONSE.objects.length === 0 && window.global_access) {

    var headings = '<h2>' + nuTranslate('Information') + '<h2>';
   var message = nuTranslate('Currently there are no objects on this Form') + '. <a href="javascript:openNuObject();">'+ nuTranslate('Start adding some') + '</a>.';
   nuMessage([headings, message]);

}


Is there any way to stop this? or is it just one to be aware of when upgrading and copy it out to paste back in to the new version?

Cheers,
Paul
pmjd
 
Posts: 110
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Re: nuuserhome Custom Code Removed on Upgrade

Unread postby kev1n » Sat Jul 24, 2021 3:09 am

All changes to nuBuilder's core forms and objects, in other words all records with a nu- primary key prefix are overwritten when updating.
Move your code to Setup->Header instead.

Example header:

Code: Select all
function nuHeaderTest() {
    console.log('Functions placed here are available anywhere in nuBuilder Forte.');
}

// nuOnLoad() will be run after each Browse and Edit Form loads.

function nuOnLoad() {

    if (nuFormType() == 'edit') {
        // Edit Form loaded
      
      if (nuCurrentProperties().form_id == 'nuuserhome') {
      
         // YOUR CODE HERE...
      }
   
   
    } else
    if (nuFormType() == 'browse') {
        // Browse Form loaded
    }

}

// </script>

<!-- Define your own styles, override styles from nubuilder4.css -->

<style>

/*.nuActionButton {background-color:#0073aa;} */



</style>


<script>   

kev1n
nuBuilder Team
 
Posts: 2145
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: nuuserhome Custom Code Removed on Upgrade

Unread postby pmjd » Mon Jul 26, 2021 12:24 am

Thanks, good to know.

I thought anything in the header would be applied globally, so only used it for a few things.
pmjd
 
Posts: 110
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Re: nuuserhome Custom Code Removed on Upgrade

Unread postby kev1n » Mon Jul 26, 2021 1:27 am

The functions in the header are run everytime a form is loaded. But you can still decide for which form the should run.
kev1n
nuBuilder Team
 
Posts: 2145
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5


Return to Installation

Who is online

Users browsing this forum: No registered users and 1 guest