cforms II User Forum

Registration is currently disabled.


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 Related Topics
Conditional admin email
November 16, 2012
10:28 am


Sorry if I am being stupid, but any pointers would be appreciated.

I have have a multi-part form, but I want to be able to trigger the email and thanks on the first form when needed.

The first part is basic contact details, and I want to ask the user if they
a) want a call back (in which case, trigger email and thanks)
b) want to get into specifics (in which case, go to a longer 2nd form, which then sends the email instead)

I have found how to change the 'next form' in my_functions, with something like (messy code since I had to work out how to get to the 'info' tickbox):

$arr= $_SESSION['cforms']['cf_form5'];
$todofieldname = $arr['$$$todo'];    
$todo = $arr[$todofieldname];

if ($todo=="info") {
#change which form comes next
return 4;

The problem with that is, it relies the user then submitting form '4', to send the enquiry.

I have a feeling I am going about this the wrong way; all I'd really like, is to trigger an email and redirect if a radio button is selected…. Should I be looking at ajax, and trying to pass something to 'cforms_submitcomment'? Help?


December 4, 2012
1:10 pm

So, this is probably  the wrong way to do this, but  what I did was:

1) made a custom wordpress template for the form handling, and created a new page using this template.
e.g. permalink "/next/"

2) created a 'starter' form with admin email disabled, custom field IDs and custom form action set to the page from 1)
 e.g. "/next/"

3) The custom 'next' page template had some php to look at the data from the first form
e.g. $todo = $_REQUEST['todo'];

then conditionally, either included secondary forms:
e.g. if ($todo == 'info') insert_cform("info-form");

…or sent an email (not as pretty as cforms own version, unfortunately). 

The secondary forms were standard one-page forms and so could use ajax etc.

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
24 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: 3763

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5359

Posts: 18742

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

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

Administrators: Oliver (6400), Nicky (3)