Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Adding New Record from Launch Form

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

Adding New Record from Launch Form

Unread post 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?
kev1n
nuBuilder Team
Posts: 4303
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Adding New Record from Launch Form

Unread post by kev1n »

2nd parameter: "-1"
kev1n
nuBuilder Team
Posts: 4303
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Adding New Record from Launch Form

Unread post by kev1n »

Use nuIsNewRecord() to detect if it is a new record.
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

Re: Adding New Record from Launch Form

Unread post 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?
kev1n
nuBuilder Team
Posts: 4303
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Adding New Record from Launch Form

Unread post by kev1n »

-1 not r
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

Re: Adding New Record from Launch Form

Unread post by icoso »

Thanks. Got it working.
Post Reply