Multi Page Forms
Posted: 08 December 2010 09:02 PM   [ Ignore ]
Is a Really Great Dancer
RankRank
Total Posts:  57
Joined  2010-08-26

Hey Guys,

First of all - I’m loving SafeCracker! Thanks for the hard work on it!

I was wondering if you could help me a little with a multi page form.  I currently have a form that has 128 different input fields.  So I have spread it over 9 different pages.  I understand how to advance to the next page and submit the values, but I was wondering if I’d be able to have a “Save” button so that the user can submit the information without having to leave the page they are on.

How would I go about that?

Thanks!

Jesse

Profile
 
 
Posted: 08 December 2010 09:21 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

I think you’ll have to use Javascript to change the value of the hidden return field:

$('input#save').click(function(){
    
$('input[name=return]').valwindow[DOT]location[DOT]href );
}); 

Replace [DOT] with an actual dot, of course.

Profile
 
 
Posted: 08 December 2010 09:48 PM   [ Ignore ]   [ # 2 ]
Is a Really Great Dancer
RankRank
Total Posts:  57
Joined  2010-08-26

Thanks Rob,

I’ve put this in place, but when I hit the save, it reloads my domain like: http://www.example.local/http://www.example.local/apply/part_2/1218

Why would it be doing that?

(sorry if this is a stupid question!)

Profile
 
 
Posted: 08 December 2010 09:58 PM   [ Ignore ]   [ # 3 ]
Is a Really Great Dancer
RankRank
Total Posts:  57
Joined  2010-08-26
$('input#save').click(function(){
    
$('input[name=return]').val("{segment_1}/{segment_2}/{segment_3}");
}); 

I don’t know if this is the right way of doing this, but it works!

Profile
 
 
Posted: 08 December 2010 10:14 PM   [ Ignore ]   [ # 4 ]
Is a Really Great Dancer
RankRank
Total Posts:  57
Joined  2010-08-26

Rob,

How would I go about adding in a notification to the user that the page actually has been saved?  I was thinking about FlashData, but that appears to only be on the control panel side…

Profile
 
 
Posted: 09 December 2010 02:09 AM   [ Ignore ]   [ # 5 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

You could add an extra segment to your return like {segment_1}/{segment_2}/{segment_3}/saved

And then

{if segment_4 == 'saved}
Changes saved!!!!!
{/if} 
Profile
 
 
Posted: 09 December 2010 02:11 AM   [ Ignore ]   [ # 6 ]
Is a Really Great Dancer
RankRank
Total Posts:  57
Joined  2010-08-26

Ha! That’s exactly what I ended up doing!

Profile