Topic RSS
8:18 pm
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.
8:29 pm
March 6, 2005
Offlineyes, with the latest release v9.2, see my-functions.php
1:04 pm
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 />
</select></li>
And I've uncommented the my_cforms_logic function.
and then...
### 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' )
return 'http://www.foo.com';
if ( $userfield == 'def' )
return 'http://www.google.com';
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
8:33 pm
March 6, 2005
OfflineMake 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()
1:47 am
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):
footheme>plugins>cforms>my-functions.php
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('myemail@gmail.com', 'cforms my_action test', print_r($cformsdata,1), 'From: myotheremail@gmail.com');
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' )
return 'http://www.paypal.com';
if ( $userfield == 'check' )
return 'http://www.mydomain.com/checkredirectpage.html';
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
7:40 am
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!
Thanks,
Aaron
12:48 am
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:
http://colinfrangos.com/luccadeli/sandwiches/order…..es-online/
(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.
6:25 am
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' )
return 'formA';
if ( $userfield == 'def' )
return 'formB';
I look forward to hear back from you :)
-T
6:44 am
Hi,
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: glamourwatcher@hotmail.com
Most Users Ever Online: 959
Currently Online:
153 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: 3548
Members: 1464
Moderators: 3
Admins: 1
Forum Stats:
Groups: 1
Forums: 4
Topics: 5157
Posts: 18386
Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass
Moderators: Paul (421), cnymike (8), sonika (95)
Administrators: Oliver (6398)
FAQs
Home
Add Reply
Add Topic
Quote











