Simple Javascript Auto Submit

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sokka888
Forum Newbie
Posts: 11
Joined: Sun Jan 18, 2009 7:44 pm

Simple Javascript Auto Submit

Post by sokka888 »

Hi experts

I have a javascript autosubmit form to worldpay gateway, which dosent work. I'm using three methords but nothing seems to work, Kindly help me overcome this issue.

Here is the code:

Code: Select all

<form action="https://select.worldpay.com/wcc/purchase"  method="post" name="PartneringContribution">
  <input type="hidden" name="instId" value="148233">
    <input type="hidden" name="cartId" value="<?=$_SESSION['id']?>">
    <input type="hidden" name="amount" value="<?=$totalAmount?>">
    <input type="hidden" name="currency" value="USD">
    <input type="hidden" name="desc" value="Contribution for project - '<?=$projName?>'">
    <input type="hidden" name="MC_joomlaid" value="<?=$_SESSION['id']?>">
    <input type="hidden" name="MC_amountpaid" value="<?=$txtTotal?>">
    <input type="hidden" name="MC_transid" value="<?=$_SESSION['id']?>">
    <input type="hidden" name="MC_projectid" value="<?=$projectID?>">
    <input type="hidden" name="MC_partneringID" value="<?=$partneringID?>">
    <input type="hidden" name="MC_contributionType" value="<?=$conType?>">
    <input type="hidden" name="MC_salesQty" value="<?=$txtqty?>">
    <input type="hidden" name="MC_reminderMonth" value="<?=$remMonth?>">
    <input type="hidden" name="MC_startDate" value="<?=$startDate?>">
    <input type="hidden" name="MC_endDate" value="<?=$endDate?>">
    <input type="hidden" name="MC_process" value="true">
    <input type="hidden" name="MC_FromPage" value="Partnering Contribution Recurring">
    <input type="hidden" name="testMode" value="0">
</form>
 
<script language="javascript">
 
    function submitForm(){
              //m1
                setTimeout('document.PartneringContribution.submit()',100);
        
              //m2
                  var form = document.PartneringContribution.submit();
          form.submit();
 
            //m3
         var myform = document.getElementsByTagName("form")[0];
         myform.submit();
    }
 

Thanks
Sokka
sokka888
Forum Newbie
Posts: 11
Joined: Sun Jan 18, 2009 7:44 pm

Re: Simple Javascript Auto Submit

Post by sokka888 »

This did the trick guys...

Code: Select all

 
<script>
 document.PartneringContribution.submit();
</script>
 
thanks
Post Reply