IN CFv3 I had the following code in the "on submit code - before sending email" field:
<?php
date_default_timezone_set('America/Chicago');
$receipt_name = JRequest::getString('receipt', 'No', 'post');
JRequest::setVar('receipt', $receipt_name);
$reqdate=date('F d, Y');
JRequest::setVar('reqdate',$reqdate);
$reqtime=date('g:i a');
JRequest::setVar('reqtime',$reqtime);
?>
I have found another way of handling setting a date and time field. What do I need to change in the lines:
$receipt_name = JRequest::getString('receipt', 'No', 'post');
JRequest::setVar('receipt', $receipt_name);
for it to work in CFv4? I have a radio button control on my form where they select either "will mail", "is attached", or "none needed". If they select "is attached" the file name is saved as the "receipt" variable. The above two lines check to see if there is a value in "receipt" and if there's not, it uses the value "No". Then the value of receipt is referenced in the email that is sent.
Thanks
Tami
Ok, you've lost me on this one. What do I do with this code?
if ( !$form->data['receipt'] ) {
$form->data['receipt'] = 'No';
}
Do I still use my original code and add yours to it or does it replace it? Do I put it in a "custom code" event or a "JS Load" event?
Sorry for all the questions.
Tami
Ok, I've posted your code into a "custom code" event in the on-submit event. However, on my thanks page I'm getting the error,
Notice: Undefined index: receipt in E:\www\www.ravenbands.org\administrator\components\com_chronoforms\form_actions\custom_code\custom_code.php(18) : eval()'d code on line 2
What am I missing? Currently the "custom code" is after the "handle arrays" event. I don't know if that makes any difference.
Tami
Hi Tami,
Looks like there isn’t any 'receipt' input data coming from the form.
Bob
Receipt is a hidden field. If the radio button "is attached" is selected then "receipt" becomes visible. That's why I was trying to set the value of it to no when it's not selected. I also tried using the "ghost" feature but can't get it to work either.