Topic RSS
12:27 am
uri=local(development); browser=firefox2;wp=2.7; my-function.php is in plugins/cforms folder.
I need help understanding the syntax for $cformsdata.
I have a form (say #9) that is part of a multipage form; "next form after this" = form#10. Among other things, form#9 is used to select a 'Diary size' using radio buttons – the options are A5, B5 and A4. Depending on chosen diary size, I want to change the next form to form#11 or form#14 (or leave as form#10). BTW in the table "wp_cformsdata", the field_val for field_name = "Diary Size" is = "A5"or "B5"or"A4".
I've tried several alternatives based on "if ( $setting == "nextForm"){:
if ( $oldvalue=='10' && $cformsdata['data']['cf9_field_4-3'] == 'checked') return 14;}
if ( $oldvalue=='10' && $cformsdata['data']['diary size'] == 'A4') return 14;}
if ( $oldvalue=='10' && $cformsdata['data']['cf9_field_4']=='A5' ) return 10;}
if ( $oldvalue=='10' && $cformsdata['data']['cf9_field_4-3'][checked] == 'yes') return 14;}
if ( $oldvalue=='10' && $cformsdata['data']['Diary size']=='A4' ) return 14;
None of these work. Can you assist please?
1:02 pm
March 6, 2005
OfflineIf uncertain about how to access the data array and the structure of it, have cforms send you a test mail (the below example is in the file under my_cforms_action()):
@mail('your@email.com', 'cforms my_action test', print_r($cformsdata,1), 'From: your@blog.com');
PS: Generally, v10.1 will be released soon that'll fix some MP feature issues (however this is not connected to the above).
2:49 am
Maybe I have misunderstood the purpose and functioning of 'my-functions.php'.
I tested cforms.php at line 249- does the 'logic' function exist? It evaluates to 'no'.
Tested putting the logic function directly into cforms.php – everything runs like clockwork.
Obviously I am missing something here; and probably pretty basic too. :(
Suggestions?
7:27 am
March 6, 2005
Offlinedid you uncomment the logic function in my-functions.php?
by default *all* functions are commented out:
/*
…
…
…
*/
9:19 am
Well, I DID say it was something pretty basic <grin>.
Me bad. I saw the uncomment reference but it didn't occur to me that all the functions were commented out.
Many thanks.
Ted
5:08 am
The function works perfect when cformsdata is on the current form. But if the data criteria refers to a page prior to the current page then the function doesn't work. Perhaps this is because it relies on trackf.
Example: page1 of a multi-page form has a data field called 'size'.
Say, I have completed page 1, page 2, and page 3 in the multi-page form.
Now I want to branch depending on the value of "size" in page1.
As I see it, the normal syntax doesn't work because it will only 'look' at the cformsdata from page 3.
Am I missing something?
7:17 am
March 6, 2005
Offlineyes, if you need to access data from a previous multi-part form, you need to access the $_SESSION array, that's where all the data is stored meanwhile.
for testing/understanding you might want to print out the array structure, just add a:
echo '<pre>'.print_r($_SESSION,1).'<pre>';
1:06 am
<thud> = sound of head hitting desk.
Of course! Changed "cformsdata" criteria to "$_SESSION['cforms']blah.." and worked a treat.
Thank you
12:32 am
I'm so glad I found this thread! I've been struggling for over a day to get a conditional multipage form working, whereby the next page you jump to is dependent on data that you entered on a previous page. I did the echo '<pre>'.print_r($_SESSION,1).'<pre>' thing as a debug aid to see how to access the values in the $_SESSION array, set up the if statements, and it works great. Being forced to learn PHP, too. ![]()
Most Users Ever Online: 959
Currently Online:
56 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: 3568
Members: 1464
Moderators: 3
Admins: 1
Forum Stats:
Groups: 1
Forums: 4
Topics: 5172
Posts: 18414
Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass
Moderators: Paul (421), cnymike (8), sonika (95)
Administrators: Oliver (6398)
FAQs
Home
Add Reply
Add Topic
Quote









