Hi all,
I have this very odd problem.
This is my view:
<?php echo CHtml::beginForm('https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay','',array('target'=>'PPDGFrame')); ?>
<?php echo CHtml::hiddenField('expType','light'); ?>
<?php echo CHtml::hiddenField('paykey',$paykey); ?>
<?php echo CHtml::submitButton('Submit',array('id'=>'submitBtn')); ?>
<?php echo CHtml::endForm(); ?>
<?php
// Event for paypal buy now
$cs = Yii::app()->getClientScript();
$cs->registerScript(
'paypal_buy',
'var dgFlow = new PAYPAL.apps.DGFlow({ trigger: "submitBtn" });
'
,
CClientScript::POS_END
);
The $paykey is generated when the action is called and stored in a table. I noticed that for every the page loads the action is called twice! So there are two rows of paykey on each page load.
Now, if you so much as change the trigger: "submitBtn" to something else, like trigger: "none" - this does not happen. I have no idea why yii calls the action twice, maybe it has to do with Ajax?
Can anyone think of something here?
Thanks!