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
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
open other forms after saving
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm
open other forms after saving
You do not have the required permissions to view the files attached to this post.
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm
Re: open other forms after saving
Where would I add it? The other form should be opened immediately after saving, without user interaction.
Re: open other forms after saving
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.
Steven
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
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm
Re: open other forms after saving
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!
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!
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm
Re: open other forms after saving
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.
Then nuHasBeenSaved() returns 1 and another form is opened with nuForm(.....). This behavior is not correct because the form has not yet been saved.
Re: open other forms after saving
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
If this doesn't work you could set and increment a global variable as you move through your different choices eg. window.myVariable
Steven
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm
Re: open other forms after saving
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?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
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.
Re: open other forms after saving
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
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