Welcome to the nuBuilder Forums!

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

open other forms after saving

Questions related to using nuBuilder Forte.
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

open other forms after saving

Unread post by marc »

Guys, the following scenario:
I'm trying to create some kind of wizard, similar to what you can see on Google Forms. You open a form and depending on which selection you made, another form is opened.
I searched the wiki and forum and came across a function called nuReturnNewRecord. This is almost what I'm looking for. The only piece of the puzzle missing is to be able to specify a form to be opened.

I have in mind a function that can accept a second parameter (form id)

nuReturnNewRecord("-1";"4a5172732c4ae31");

@param1: record id (-1 or empty => open blank record)
@param2: form id (if not specified, open same form)

For a better understanding I created a small diagram
diagram.png
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: open other forms after saving

Unread post by admin »

marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: open other forms after saving

Unread post by marc »

Where would I add it? The other form should be opened immediately after saving, without user interaction.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: open other forms after saving

Unread post by admin »

marc,

You'll need to put something like this in the Javascript section of the Form to redirect it once the Form has been saved.

eg.

Code: Select all

if(nuHasBeenSaved() == 1){

   if($('#question1').val() == 1){
      nuForm("4a5172732c4ae31", '-1');     //--  redirect to this Form.
   }else{
      nuForm("4a5172732c4ae66", '-1');     //--  redirect to this Form.
   }

}


Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: open other forms after saving

Unread post by marc »

This works very well in most cases. After intensive testing it turned out that the function nuHasBeenSaved sometimes returns a 1 even though the form was not saved.
After rearranging objects or refreshing the form (via the Options menu) nuHasBeenSaved obvisouly a wrong result. Can you look into it? Thank you in advance!
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: open other forms after saving

Unread post by admin »

marc,

Can you explain how to reproduce that error?

Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: open other forms after saving

Unread post by marc »

So I added the code to my form. I open it, use Arrange Objects from the option menu, hit save in the dialog.
Then nuHasBeenSaved() returns 1 and another form is opened with nuForm(.....). This behavior is not correct because the form has not yet been saved.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: open other forms after saving

Unread post by admin »

marc,

If this doesn't work you could set and increment a global variable as you move through your different choices eg. window.myVariable


Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: open other forms after saving

Unread post by marc »

admin wrote:marc,

If this doesn't work you could set and increment a global variable as you move through your different choices eg. window.myVariable


Steven
Steven, could you explain in more detail how this would work and where do I have to declare the variable and where do I increment it?

Actually, I just need a reliable way to discover when a record has just been saved. I also searched the forum and found many posts describing the same issue. But there seems to be no solution.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: open other forms after saving

Unread post by admin »

marc,

I'm still trying to understand the things you did to make nuHasBeenSaved() not work.


Is this right...

1. So I added the code to my form.
2. I open it.
3. Use Arrange Objects from the option menu.
4. Hit save in the dialog.


I don't understand Use Arrange Objects.

I thought you were editing and saving records when the problem happened.


Steven
Post Reply