Forums

SECOND FORM NOT SUBMITTING

atanunu 11 Sep, 2016
I have a form; on the submit action I have included another form which I want to submit automatically on the submit action. I changed the settings and made the form to submit on ajax - now the form I included on the submit action is not working kindly help

<?php
// NOT THAT HASH IS (txn_ref + product_id + pay_item_id + amount + site_redirect_url + mac key)
$a = $form->data['PWFtransactionpasscode']; //txn_ref 942107H8756774GA
$b = $form->data['PPGgatewayproductcode']; // product_id AS issued by interswitch 6205
$form->data['product_id'] = $b;

$c = $form->data['PPGgatewayclientid']; // pay_item_id AS issued by interswitch 101
$form->data['pay_item_id'] = $c;

$da = $form->data['PWFclientamountnaira']; // in naira or usd
$db = $da * 100;
$d = $db; // amount(kobo value)

$form->data['amountkobo'] = $d;
$amountkobo = $form->data['amountkobo'];

$e = $form->data['PPGreturnurl'];  //site_redirect_url https://sandbox.probun.com/p/InterSwitch
$f = $form->data['PPGgatewaymackey']; // MacKey

// compute for the hash ( txn_ref + product_id + pay_item_id + amount + site_redirect_url + mackey)
$hashv = $a.$b.$c.$d.$e.$f; // concatenate the strings for hash this time different parameters
$thash = hash('sha512',$hashv);
$form->data['hash'] = $thash;
?>

<!-- REDIRECTION FORM -->
<form id="my_form" method="post" action="<?php echo $form->data['PPGgatewayurl']; ?>">
<input name="product_id" type="hidden" value="<?php echo $form->data['product_id']; ?>" />
<input name="amount" type="hidden" value="<?php echo $form->data['amountkobo']; ?>" />
<input name="currency" type="hidden" value="<?php echo $form->data['PPGgatewaycurrency']; ?>" />
<input name="site_redirect_url" type="hidden" value="<?php echo $form->data['PPGreturnurl']; ?>"/>
<input name="txn_ref" type="hidden" value="<?php echo $form->data['PWFtransactionpasscode']; ?>" />
<input name="hash" type="hidden" value="<?php echo $form->data['hash']; ?>" />
<input name="pay_item_id" type="hidden" value="<?php echo $form->data['pay_item_id']; ?>" />

<input name="cust_id" type="hidden" value="<?php echo $form->data['PWFcustomeremail']; ?>" >
<input name="cust_name" type="hidden" value="<?php echo $form->data['PWFcustomername']; ?>" >

<!-- <input name="pay_item_name" type="hidden" value="<?php echo $form->data['PWFcustomername']; ?>" > --> 
</form>
<!-- REDIRECTION FORM --> 


<script type="text/javascript">
    function submitForm() {
        document.getElementById('my_form').submit();
    }
    window.onload = submitForm;
</script>

<div><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/Processingx.gif" alt="" /></div>

<marquee behavior="scroll" direction="left" scrollamount="-1"><span style="font-size:18px; color:#319ed6;"><strong>Transferring you to Interswitch.<strong></span></marquee>



https://sandbox.probun.com/WebPay/ExternalCollection?id=991600U8603193JJ&showprint=Y
atanunu 11 Sep, 2016
Please, I will appreciate a different method instead of Javascript if possible
GreyHead 14 Sep, 2016
Hi atanunu,

Turn off the AJAX submission - I don't think that a redirect will work if the form is not submitted normally.

You can use the ChronoForms ReDirect action if you want to redirect the user to the payment gateway, or the auto-submitting form you have here should also work. If you prefer not to use JavaScript then add a 'Pay Now' submit button to the gateway form.

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