I can't work it out but my group checkbox submission is not being written to my database.
Thanks for that, that worked great (and just for anyone else trying this, I then also had to list the array field in the appropriate section for my Chronoconnectivity connection). 😀
Ok so I've hit an issue trying to display the array in the e-mail. Bellow is my code that I have as a custom code (after the DB action but before sending the e-mail) and hopefully as I explain what I've done it will all come clear to me 😛
The array $form->data['aagroup'] should hold a combination of U15,U17,U19,Premiers. I want the e-mail to display the associated description (note that their are two different variables $selectedoption and $selectecoptions).
If the array holds "U15,Premiers" then I want $form->data['aagroup'] to store "Under 15s - Players who remain 14 years of age and under until 31 December 2013. Wednesday is competition league night in Terms 2 and 3.<br />Premiers'=>'Would like to be considered for Senior Premiers." on exit
The array $form->data['aagroup'] should hold a combination of U15,U17,U19,Premiers. I want the e-mail to display the associated description (note that their are two different variables $selectedoption and $selectecoptions).
If the array holds "U15,Premiers" then I want $form->data['aagroup'] to store "Under 15s - Players who remain 14 years of age and under until 31 December 2013. Wednesday is competition league night in Terms 2 and 3.<br />Premiers'=>'Would like to be considered for Senior Premiers." on exit
<?php
$aagroup = array(
'U15'=>'Under 15s - Players who remain 14 years of age and under until 31 December 2013. Wednesday is competition league night in Terms 2 and 3.',
'U17'=>'Under 17s - Player who remain 16 years of age and under until 31 December 2013. Thursday/Friday is competition league night in Terms 2 and 3.',
'U19'=>'Under 19s/Open Men’s - Player must be under 19 as 1 January 2013 and be a full-time student. Thursday/Wednesday is competition league night in Terms 2 and 3.',
'Premiers'=>'Would like to be considered for Senior Premiers.'
);
$selectedoptions = '';
$arrayoptions = $form->data['aagroup'];
foreach ($arrayoptions as $selectedoption) $selectedoptions=$selectedoptions+'<br />'+$aagroup[$selectedoption];
$form->data['aagroup'] = $selectedoptions;
?>
Found a mistake with my concatenation, and made some changes but no joy.. looks like I have something wrong with the foreach loop but I know not what 🤨
<?php
$aagroup = array(
'U15'=>'Under 15s - Players who remain 14 years of age and under until 31 December 2013. Wednesday is competition league night in Terms 2 and 3.',
'U17'=>'Under 17s - Player who remain 16 years of age and under until 31 December 2013. Thursday/Friday is competition league night in Terms 2 and 3.',
'U19'=>'Under 19s/Open Men’s - Player must be under 19 as 1 January 2013 and be a full-time student. Thursday/Wednesday is competition league night in Terms 2 and 3.',
'Premiers'=>'Would like to be considered for Senior Premiers.'
);
$option = '';
foreach ($form->data['aagroup'] as $selectedoption) {
$options=$options.'<br />'.$aagroup[$selectedoption];
}
$form->data['aagroup'] = $options;
?>
Hi rcadmin,
The code works OK assuming that you start with a valid array. (Except that you define $option then use $options - that creates a PHP Notice but isn't a major problem.)
Please drag a Debugger action into the event where you have this code then post the debug results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.
Bob
The code works OK assuming that you start with a valid array. (Except that you define $option then use $options - that creates a PHP Notice but isn't a major problem.)
Please drag a Debugger action into the event where you have this code then post the debug results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.
Bob
This is the Code before writing to the DB (Debugger 22)
I then execute the custom code as mentioned above and then my form data becomes (Something's gone wrong with how I'm doing things; Debugger 20.)
[attachment=0]Actions.jpg[/attachment]
Data Array:
Array
(
[chronoform] => Basketball_913_Enrollment
[event] => submit
[Itemid] => 334
[option] => com_content
[view] => article
[id] => 802
[firstname] => Fred
[surname] => Smith
[address] => Rosmini
[suburb] => Auckland
[postalcode] => 0622
[dob] => 2008-06-07
[schoolyear] => 9
[parentname] => Peter
[pemail] =>
peter@noemail.com
[pphone] => 123456767
[smobile] =>
[aagroup] => U17,Premiers
[permissiontoplay] => 1
[volunteercoach] =>
[volunteermanager] =>
[volunteerscorer] =>
[volunteerother] =>
[attendingskillsclinic913] => No
[uniformrequirements] => 1
[yeslocation] => 1
[playerregistration] => 1
[skillstrainingreq] => No
[paymentmethod] => Cash
[paymentdue] => 115
[othercomments] =>
[chrono_verification] => uJQ8m
[429b0d18c405bba46625d6de5ffec171] => 1
)
Validation Errors:
Array
(
)
I then execute the custom code as mentioned above and then my form data becomes (Something's gone wrong with how I'm doing things; Debugger 20.)
Data Array:
Array
(
[chronoform] => Basketball_913_Enrollment
[event] => submit
[Itemid] => 334
[option] => com_content
[view] => article
[id] => 802
[firstname] => Fred
[surname] => Smith
[address] => Rosmini
[suburb] => Auckland
[postalcode] => 0622
[dob] => 2008-06-07
[schoolyear] => 9
[parentname] => Peter
[pemail] =>
peter@noemail.com
[pphone] => 123456767
[smobile] =>
[aagroup] =>
[permissiontoplay] => 1
[volunteercoach] =>
[volunteermanager] =>
[volunteerscorer] =>
[volunteerother] =>
[attendingskillsclinic913] => No
[uniformrequirements] => 1
[yeslocation] => 1
[playerregistration] => 1
[skillstrainingreq] => No
[paymentmethod] => Cash
[paymentdue] => 115
[othercomments] =>
[chrono_verification] => uJQ8m
[429b0d18c405bba46625d6de5ffec171] => 1
[chronoform_data] => Array
(
[cf_uid] => a7c13a23e8cc2ebd1378ab61dbce652f
[cf_created] => 2012-11-19 06:13:58
[cf_created_by] => 42
[cf_ipaddress] => 101.98.142.92
[cf_user_id] => 42
[chronoform] => Basketball_913_Enrollment
[event] => submit
[Itemid] => 334
[option] => com_content
[view] => article
[id] => 802
[firstname] => Fred
[surname] => Smith
[address] => Rosmini
[suburb] => Auckland
[postalcode] => 0622
[dob] => 2008-06-07
[schoolyear] => 9
[parentname] => Peter
[pemail] =>
peter@noemail.com
[pphone] => 123456767
[smobile] =>
[aagroup] => U17,Premiers
[permissiontoplay] => 1
[volunteercoach] =>
[volunteermanager] =>
[volunteerscorer] =>
[volunteerother] =>
[attendingskillsclinic913] => No
[uniformrequirements] => 1
[yeslocation] => 1
[playerregistration] => 1
[skillstrainingreq] => No
[paymentmethod] => Cash
[paymentdue] => 115
[othercomments] =>
[chrono_verification] => uJQ8m
[429b0d18c405bba46625d6de5ffec171] => 1
[cf_id] => 77
)
[chronoform_data_cf_id] => 77
)
Validation Errors:
Array
(
)
Debug Data
Core Captcha
Passed the core captcha check!
Debug Data
Core Captcha
Passed the core captcha check!
[attachment=0]Actions.jpg[/attachment]
Hi RCadmin,
Looks as though you have a Handle Arrays action in place that is turning the result from an array into a string. Simplest answer is to move the Custom Code before the Handle Arrays action.
Bob
Looks as though you have a Handle Arrays action in place that is turning the result from an array into a string. Simplest answer is to move the Custom Code before the Handle Arrays action.
Bob
Ok.... it won't be that simple as I need the e-mail sent after the DB operation which means I need the handle array done first.
What I might do is add a hidden field called message and then assign the message field to the string that I want. As this won't be saved in the DB, it won't make any difference where I assign it.
Will try later.
Thanks
What I might do is add a hidden field called message and then assign the message field to the string that I want. As this won't be saved in the DB, it won't make any difference where I assign it.
Will try later.
Thanks
Finally, using a temporary variable (recommended by Max) and then fixing some coding errors, I achieved what I wanted :-)
<?php
$aagroup = array(
'U15'=>'Under 15s - Players who remain 14 years of age and under until 31 December 2013. Wednesday is competition league night in Terms 2 and 3.',
'U17'=>'Under 17s - Player who remain 16 years of age and under until 31 December 2013. Thursday/Friday is competition league night in Terms 2 and 3.',
'U19'=>'Under 19s/Open Men’s - Player must be under 19 as 1 January 2013 and be a full-time student. Thursday/Wednesday is competition league night in Terms 2 and 3.',
'Premiers'=>'Would like to be considered for Senior Premiers.'
);
$options = '';
$selectedaagroup = $form->data['aagroup'];
foreach ($selectedaagroup as $selectedoption) {
$options=$options.'<br />'.$aagroup[$selectedoption];
}
$form->data['selectedoptions'] = $options;
?>
This topic is locked and no more replies can be posted.