Registration is currently disabled.
This plugin keeps surprising me as it is really versatile.
Now I want to push it further and try to make a conditional redirect–if a user selects a specific checkbox it will be sent to another form (form B) but if the user doesn't check that option he will be sent to a succesful page.
Can this be done? I hope so.
March 6, 2005
Hello and thanks for a great plugin. I'm trying to modify my-functions.php to use a conditional redirect. I'm not sure what I'm doing wrong.
I've got the drop down:
<li id="li--19"><label for="cf_field_19"><span>userfield</span></label><select name="cf_field_19" id="cf_field_19" class="cformselect" ><br />
<option value="abc">abc</option><br />
<option value="def">def</option><br />
And I've uncommented the my_cforms_logic function.
### note: '$$$mypick' references the ID of the HTML element and has been assigned
### to the drop down field in the form configuration, with [id:mypick] !
$userfield = $cformsdata['data'][$cformsdata['data']['$$$cf_field_19']];
if ( $userfield == 'abc' )
if ( $userfield == 'def' )
I'm not sure how to or where to define the drop down.
Does the field name matter?
Am I using the correct ID? Thanks
March 6, 2005
Make sure you have a default redirection target defined on your form config page. For testing, simply do not use any IF's etc. just return a new redir target.
Then continue with more complex code.
If you're unsure how to reference $cformsdata use the below @mail call to send you the data array:
simply add the above line to my_cforms_logic()
Perfect. Thanks for your help. I can now do conditional redirects. I will say that this is one of the most well thought out and well developed plugins I've come across in the long time. Good for you.
To reiterate what I did for anyone else coming across this issue:
To make a conditional redirect:
In my case I wanted to redirect (on submit) to a paypal url if the user checks "paypal" as a payment method, or to redirect (on submit) to a "send your check" page if the user checks "check" as a payment method.
First I set a default redirect on the form itself:
FormFoo> form settings > Core Form Admin / Email Options > Redirect
options: > http://www.foositeA.com
Then I open and modify (note – my line numbers might be off by a few):
I uncomment the code ( move the /* on line 15 to line 78) This step uncomments the my_cforms_logic function so I can use it.
Now you'll need to change the variable '$$$mypick' on line 65. In order to know which field set ID you need to change it to, I used the above (post above this) method. I added:
@mail('email@example.com', 'cforms my_action test', print_r($cformsdata,1), 'From: firstname.lastname@example.org');
to line 31. Now when the function runs, it is going to send me an email with data array generated by the form. Mine returned this for my paypal option menu:
[$$$17] => How do you wish to pay for your entry?
[How do you wish to pay for your entry?] => paypal
Down around line 65:
I change the variable to this:
if ( $userfield == 'paypal' )
if ( $userfield == 'check' )
Note the change to $$$17.
Now when the user chooses paypal from the drop down menu, on submit they are redirected to the paypal url. If they choose check, they are redirected to my pay by check information page.
Oliver was kind enough to help me out with this issue. That is why I've taken the time to explain the process in detail for the next guy. If this helps you, pay it forward and help someone else in this forum. Also click on some advertising here as a thank you to Oliver.
keywords: conditional redirect , redirect , my-functions.php , my_cforms_logic function , multiple redirects , optional redirect , pay pal
I have a similar issue that maybe you can help me with. I'm using a select box with 10-15 items within. When the user selects 1 they are directed to that particular website after clicking submit. If they come back and choose a different option in the select box, they are then directed again to a different website.
Any ideas would be great!
I have a similar issue that I hope you can help with.
I'm using this excellent plug in to set up a sandwich ordering form for a local deli. The previous form was a mess and impossible for them to use, so this is already an improvement.
Here is the form I threw together quickly to test this plugin:
(I haven't done any styling on the form yet, so it's a little hard to read in places)
The additional functionality I need is the ability to order multiple sandwiches in the same session. In other words, the buttons at the bottom of the second page should be: Previous Page, Add Another Sandwich, Finish Order. Choosing the second option ("Add Another Sandwich") would take the user to another instance of the same page to create a separate order (I'm assuming they could be sequentially numbered in the submitted email). This seems like it's outside of the scope of this plugin, but not by much. Unfortunately I'm a designer and not a programmer, so I'm at a lost as to how to get this additional functionality to work.
WP version 2.9.1, cforms version 11.3
Thanks in advance.
First of all, I would like to second Mike in his kudos to Oliver and anyone else who contributed to cFroms. Its by far the most intuitive, logical and beautiful solution
out there. Thank you for gracing us with such a gift.
Mike, Pilgrim2009 and definitely Oliver should know the solution to my question, and
since Pilgrim2009 had already asked this question as well. As a designer am slowly
poking around the codes, but can't really figure it out.
I did the @email call and identified $$$mypick as well. I think i have got it til what
Mike did, thanks to all of you.
In this case, what do I have to do to the 'return' values if I want 'abc' to go to 'formA'
and 'def' to go to 'formB'
$userfield = $cformsdata['data'][$cformsdata['data']['$$$mypick']];
if ( $userfield == 'abc' )
if ( $userfield == 'def' )
I look forward to hear back from you :)
I have placed an earlier post about redirection. Because I hope someone can help me. First, this is a great plugin ! Do you have a picture and referral for free advertising on 3 websites ?
Sorry, but I am a wordpress php geek! So can someone please give me a simple tutorial about redirection ?
Uploading, installing, activating, post and page display and use no problem. But I really would like a profile page redirected with data from the comment form. How can I do that ?
please mail me: email@example.com
Most Users Ever Online: 959
Currently Browsing this Page:
Guest Posters: 3661
Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass
Moderators: Paul (421), cnymike (8), sonika (95)
Administrators: Oliver (6399)