Forums

Chronoforms v5 - On Submit Query Parameter is wrong

annekm 29 Apr, 2016
Hi,

I am using Chronoforms page as the response url from a Payment Gateway. The values of the $_POST/$_REQUEST array need to be populated into my form fields (they are readonly fields). I was able to achieve this by adding the following Custom Code in my onLoad event.


<?php if($_REQUEST['f_code']=="Ok"){ 
    $form->data['txnstatus'] = 'Success';
?>
Success : Your Transaction is been processed.
<?php } else {
    $form->data['txnstatus'] = 'Failed';
?>
Failure : Your Transaction couldnot be processed.
<?php } ?>
<?php
    //$form->data['txnstatus'] = $_REQUEST['f_code'];
    $form->data['txnid'] = $_REQUEST['mmp_txn'];
    $form->data['banktxn']  = $_REQUEST['bank_txn'];
    $form->data['name'] = $_REQUEST['udf1'];
    $form->data['email']  = $_REQUEST['udf2'];
    $form->data['bankname'] = $_REQUEST['bank_name'];
    $form->data['ipgtxn']  = $_REQUEST['ipg_txn_id'];
?>


Once this code was added my On Submit event was not working.

I have identified that this is because the query parameter for the url is wrong. The expected url would be the following which I get if the above Custom PHP Code is not used:

/index.php?option=com_chronoforms5&chronoform=Response&event=submit



But once, my PHP code is used, I get the url:

/response?chronoform=Response&event=submit



I am unable to work out the reason for this to happen.

In my on Load event, I have HTML Render form and the Custom Code.

In my On Submit event, I need to do a DB Save and display a message.

Can you please help me identify why this is happening?

Regards,
Anu
GreyHead 30 Apr, 2016
Hi Anu,

Please see this FAQ

Note that all the $_REQUEST data is added to the $form->data[''] array - if you change some names you may be able to reduce the need for this extra code. Use a Debugger action to see the content of the array.

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

VPS & Email Hosting 20% discount
hostinger