nuOnLoad() event
Posted: Fri Feb 02, 2018 10:42 pm
Hi Steven,
i have a few forms that require a bit of setup before they are displayed. Up to now i have been adding a nuOnLoad() function into each form's javascript.
At first i thought i had discovered a bug but in retrospect upon reading the documentation i don't think i have.
So on one of my form's if it is a new record and it is in edit mode, the forms nuOnLoad() removes two tabs. It worked fine until i clicked back to the user home and it wiped out my tabs there too.
After adding a couple of console.log functions i realised that the form's nuOnLoad() was firing when going to any form that was in Edit mode with a record of ID of -1.
This makes sense after reading the wiki as you state that this function is best added to the header setup.
I have got around the problem by adding an if statement within the forms nuOnload() to test the form_id property from nuCurrentProperties().
I much to prefer to add code to the relevant form as it makes them easier to follow and update at a later stage.
So i wonder if in future if this can only altered so that if a form has a nuOnLoad() function it only run on that form by default.
Andrew
i have a few forms that require a bit of setup before they are displayed. Up to now i have been adding a nuOnLoad() function into each form's javascript.
At first i thought i had discovered a bug but in retrospect upon reading the documentation i don't think i have.
So on one of my form's if it is a new record and it is in edit mode, the forms nuOnLoad() removes two tabs. It worked fine until i clicked back to the user home and it wiped out my tabs there too.
After adding a couple of console.log functions i realised that the form's nuOnLoad() was firing when going to any form that was in Edit mode with a record of ID of -1.
This makes sense after reading the wiki as you state that this function is best added to the header setup.
I have got around the problem by adding an if statement within the forms nuOnload() to test the form_id property from nuCurrentProperties().
I much to prefer to add code to the relevant form as it makes them easier to follow and update at a later stage.
So i wonder if in future if this can only altered so that if a form has a nuOnLoad() function it only run on that form by default.
Andrew