Page 1 of 1

Adding New Record from Launch Form

Posted: Mon Jul 12, 2021 4:05 pm
by icoso
I have a launch form that give the users the ability to open a CustomerForm or Open a CustmerSearchForm. The CustomerForm opens the standard browse screen using:

Code: Select all

nuForm('6025b999ee999dd', '', '', '', '0');
From there I can do a normal search for records or Click Add to add a new record into the database.

How can I bypass this browse form and open the form "6025b999ee999dd" in Edit mode for a new record? Im assuming I'd use the nuForm() function, but the description on https://wiki.nubuilder.cloud/ ... ipt#nuForm isn't real clear on what the second option should be. How do I get the "record id of the Edit Form " for a new blank record?

ALSO, Normally when this form opens in Edit Mode (when the user clicks a record that is listed on the browse screen), I run this: nuDisableAllObjects(); to prevent the user from accidentally editing fields on a record. They have to click an "Edit" button to enable all the objects on the screen. How can I test for if this is a new record that was opened from the launch form or the user pressed the "Add" button on the browse form? So in the event the user wants to add a new record, they don't have to press the "Edit" button to enable all the fields?

Re: Adding New Record from Launch Form

Posted: Mon Jul 12, 2021 4:40 pm
by kev1n
2nd parameter: "-1"

Re: Adding New Record from Launch Form

Posted: Mon Jul 12, 2021 4:42 pm
by kev1n
Use nuIsNewRecord() to detect if it is a new record.

Re: Adding New Record from Launch Form

Posted: Mon Jul 12, 2021 4:50 pm
by icoso
OK, So I tried this. I added a button on my launch form to "Add a new record." I used this to call the form.

Code: Select all

nuForm('6025b999ee999dd', r, '', '', '0');
It opens the form in Edit mode, BUT everything is disabled. This is the code I use

Code: Select all

if (!nuIsNewRecord()) {      // if not..
    nuDisableAllObjects();
}
If I click the "Add" button from the browse screen, All objects are enabled. If I open the edit form from the launch form, All objects are disabled. So what is the difference In opening the edit form with a new record in both of these methods?

Re: Adding New Record from Launch Form

Posted: Mon Jul 12, 2021 5:00 pm
by kev1n
-1 not r

Re: Adding New Record from Launch Form

Posted: Mon Jul 12, 2021 7:10 pm
by icoso
Thanks. Got it working.