Adding New Record from Launch Form

Questions related to customising nuBuilder Forte with JavaScript or PHP.

Adding New Record from Launch Form

Unread postby icoso » Mon Jul 12, 2021 11:35 pm

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.net/nubuilderfor ... 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?
icoso
 
Posts: 181
Joined: Mon Feb 08, 2021 7:39 am
nuBuilder Version: 4.5

Re: Adding New Record from Launch Form

Unread postby kev1n » Tue Jul 13, 2021 12:10 am

2nd parameter: "-1"
kev1n
nuBuilder Team
 
Posts: 1996
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Adding New Record from Launch Form

Unread postby kev1n » Tue Jul 13, 2021 12:12 am

Use nuIsNewRecord() to detect if it is a new record.
kev1n
nuBuilder Team
 
Posts: 1996
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Adding New Record from Launch Form

Unread postby icoso » Tue Jul 13, 2021 12:20 am

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?
icoso
 
Posts: 181
Joined: Mon Feb 08, 2021 7:39 am
nuBuilder Version: 4.5

Re: Adding New Record from Launch Form

Unread postby kev1n » Tue Jul 13, 2021 12:30 am

-1 not r
kev1n
nuBuilder Team
 
Posts: 1996
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Adding New Record from Launch Form

Unread postby icoso » Tue Jul 13, 2021 2:40 am

Thanks. Got it working.
icoso
 
Posts: 181
Joined: Mon Feb 08, 2021 7:39 am
nuBuilder Version: 4.5


Return to Custom Code

Who is online

Users browsing this forum: No registered users and 6 guests