Forums

Code changes necessary in v4?

jonathangreen 14 Sep, 2011
I have been using Chronoforms in Jv1.5 and this piece of script has worked well (taken and modified from your Chronoforms book).
<?php
$action_req = JRequest::getString('input_radio_25','','post');
$emails=array (
'Further Action Required' => 'j@hpa.org.uk', 
);
$email_to_use = $emails[$action_req];
JRequest::setVar('email_to_use',$email_to_use);

$_POST['subject'] = "".$_POST['input_text_17'] 
?>


Moving to Joolmla 1.7 and latest version of chromoforms, it doesn't work. I have inserted into 'on submit' events as the first action.

Is the code still ok and/or is there something else that I need to do?
Thanks for any advice
BW
GreyHead 15 Sep, 2011
Hi jonathangreen,

Max has changed the way that the form data is handled in CFv4. The JRequest::getVar() methods will work but ChronoForms no longer sees values set with JRequest::setVar().

Here's a modified version
<?php
$action_req = $form->data['input_radio_25'];
$emails = array (
  'Further Action Required' => 'j@hpa.org.uk'
);
$form->data['email_to_use'] = $emails[$action_req];
?>

Bob
jonathangreen 16 Sep, 2011
Hi Bob
Thanks but still not working. Here is the debug information:

[input_radio_25] => FurtherActionRequired
[input_submit_9] => Submit
[efae061c20acfa4f65675be08e84a72d] => 1
[option] => com_chronoforms
[chronoform] => telelogger4
[event] => submit
[Itemid] =>
[email_to_use] =>
[_PLUGINS_] => Array
(

code is :
<?php
$action_req = $from->data['input_radio_25'];
$emails = array (
  'FurtherActionRequired' => 'j@hpa.org.uk'
);
$form->data['email_to_use'] = $emails[$action_req];
?>

So input_radio_25 has appropriate value (matches info on on submit code) but email to use is empty. Grateful for any thoughts? Thanks
GreyHead 16 Sep, 2011
Hi jinathangreen,

Sorry typo alert! This line should be $form->data (not $from->data)
$action_req = $form->data['input_radio_25'];

Bob
This topic is locked and no more replies can be posted.