Welcome to the nuBuilder Forums!

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

Access without login - Save & Close - load another address

Post Reply
FBC-Tim
Posts: 25
Joined: Thu Jun 23, 2011 6:08 am

Access without login - Save & Close - load another address

Unread post by FBC-Tim »

I would like to allow users without a login to my nuBuilder site to complete an edit form for a new record, save the data, and be redirected out of my nuBuilder site to another address.

By setting "Access without login" to YES on my form I can use an address like below to access an edit form to allow someone without a password to enter a new record.

Code: Select all

http://nufbc.mydomain.org/productionnu2/nubuilder.php?x=1&f=14e03d856b2f40&r=-1&dir=db/mySample&ses=14e091918da3f3
On ths form the only button I have available is SAVE & CLOSE.
Is this the correct button to use for what I am trying to achieve?

When the user has entered the data and presses Save & Close, the data is saved nicely, but the user is redirected to a blank address.

I tried putting some code in the After Save section of the Edit Code but i dont think this is the right place for it.

How can I make nuBuilder load another page on my site (outside nuBuilder) after Save & Close is pressed?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Access without login - Save & Close - load another address

Unread post by admin »

FBC-Tim,

You can create a function called JavaScript nuBeforeSave()

(its explained in the wiki)
http://wiki.nubuilder.com/tiki-index.ph ... eforeSave_

eg.

Code: Select all


function nuBeforeSave() {

   window.open('http://www.google.com');
   return true;

}

Steven
FBC-Tim
Posts: 25
Joined: Thu Jun 23, 2011 6:08 am

Re: Access without login - Save & Close - load another address

Unread post by FBC-Tim »

Using nuBeforeSave() in Javascript as explained above opens the address in a new window/tab and leaves the page we just saved blank.

I have found something else that seems to work ok.
I put the following php in the Edit Code - After Save section:

Code: Select all

/* Redirect browser */
header("Location: http://websitehere.com");
/* Make sure no more code gets executed when we redirect. */
exit;
This seems to be working, the record is saved and another page (outside the nuBuilder app) loads in the same browser window.

But I am concerned there may be some side effect from using this I am not aware of?
Is this ok to use or will it cause problems?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Access without login - Save & Close - load another address

Unread post by admin »

FBC-Tim

I don't see that a redirect would be a problem.

Steven
Post Reply