cforms II User Forum

Registration is currently disabled.
Guest

FAQs

Login form protected by Login LockDown.


Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Conditional Redirect - multi-page forms
July 14, 2011
6:11 pm
issora
Guest

I ran across a lot of questions about conditional redirects in the Troubleshooting forum when I was researching the topic, so I thought I'd post the solution I found success with.  The code below belongs on the myfunctions.php file and is specific to the Multi-page format.  

 

Basically, this code states that if field #5 ($$$5) in form id 8 ($cformsdata['id']==8)is answered "No" by the user (this field is setup as a radio button, but this would also work with a select box or check box group) and the 'Next' button is clicked, the user is taken to form id 10 (return 10). But if they answer "Yes" (or any other option besides "No"), they are taken to form 9 ($oldvalue=='9').

 

if ( $setting == "nextForm" ) {

if ( $cformsdata['id']==8 ){

$userfield = $cformsdata['data'][$cformsdata['data']['$$$5']];

if ( $oldvalue=='9' && stripos($userfield, 'No')!==false )

return 10;
else
return $oldvalue;

}

}
 
 

Hoping this helps someone else searching for this particular solution!

January 6, 2012
8:17 pm
Darryl
Guest

This does not work for me. What should i set the "Please choose the next form after this" drop down menu (in Multi Form section) as when I use this method. Also, where exactly does it go in the myfunctions.php? Also, is the Next button the same as the submit button.

 

Thanks

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
32 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3731

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5331

Posts: 18693

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)