Sounds like you're trying to implement a warez script to me. Regardless, why
not try this...

What you want to do is return a valid completion back to the 'opener'
window. 

So on the transaction being successful you pass the
opener.document.forms.firstForm.formaction.disabled = true from the popup
window, where the firstform is the name of the form and formaction is the
name of the button.

As far as posting before JavaScript events what you do is give the new
window a name and use the TARGET attribute on the tag/form you are
submitting using that name. then your JavaScript can disable the form
submit.

Or here's a 1:30am quick and dirty attempt. The only problem with this in
difference to the above transaction is if the above transaction is not
successful it will not know so you will have to set the disabled property to
false from the opener window: <your problem>

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
        
        function openWindow(url,formNo) {
                bob =
window.open(url,"bob","width=200,height=300,top=10,left=150");
                bob.focus();
                document.forms[formNo].thisButton.disabled = true;
                return true;
                }
                
</SCRIPT>

<FORM ACTION="javascript:void();" METHOD="post" NAME="thisForm"
ID="thisForm" TARGET="bob">
        <INPUT TYPE="submit" NAME="thisButton"
onClick="openWindow('http://www.coffee.com.au',0);">
</FORM>

<FORM ACTION="javascript:void();" METHOD="post" NAME="thisForm"
ID="thisForm" TARGET="bob">
        <INPUT TYPE="submit" NAME="thisButton"
onClick="openWindow('http://www.cffaq.com',1);">
</FORM>

<FORM ACTION="javascript:void();" METHOD="post" NAME="thisForm"
ID="thisForm" TARGET="bob">
        <INPUT TYPE="submit" NAME="thisButton"
onClick="openWindow('http://thedream.seven.com.au',2);">
</FORM>

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jamie
Lawrence Jenner
Sent: Friday, 27 August 2004 9:23 PM
To: CFAussie Mailing List
Subject: [cfaussie] good js forums?

hi

i have a js problem (below) if anyone can help, but i would like to know
of some good javascript forums. ive looked around but if anyone can
recommend any then that would be great


jamo

1.
hi guys,

i have a page which a user will see when they have placed an order. The
user is then required to submit paymant for each amount seperatly. the
user is presented with the following forms, which open a pop up for them
to pay (thorugh worldpay,paypal etc) and the form variables are passed
with a post.

<form name="payment1" target="vendor" action="someaction" method="post">
<input type="hidden" name="item_number" value="BGS_1_fun007_2">
<input type="hidden" name="amount" value="5.50">
<input id="payment1submit" type="submit" name="submit" >
</form>

<form name="payment2" target="vendor" action="someaction" method="post">
<input type="hidden" name="item_number" value="BGS_2_fun007_2">
<input type="hidden" name="amount" value="5.50">
<input id="payment2submit" type="submit" name="submit" >
</form>

<form name="payment3" target="vendor" action="someaction" method="post">
<input type="hidden" name="item_number" value="BGS_3_fun007_2">
<input type="hidden" name="amount" value="5.50">
<input id="payment3submit" type="submit" name="submit" >
</form>


so basically, when the user clicks on the payment1 submit button, it needs
to submit its form (in a new window), and then disable itself so that the
user cant submit payment for the same item by mistake. they then clikc on
payment2 submit which does the same and so on, until all forms have been
posted. Each form has a unique name, as does each submit button. I have
written scripts which disable form elements based on the onclick event,
but using this it only disables the form submit button, and doesnt allow
the form to post first, then disable itself.

cheers in advance. 

jamo

2.
<SCRIPT Language="JavaScript">

function submitTheFormDagnammit(formname) {
//loop through form elements to look for the submit type and set it to
disabled
for (i=1; i<document.forms[formname].elements.length; i++) {
if (document.forms[formname].elements[i].type == 'submit') {
document.forms[formname].elements[i].disabled = true;
}
}
//submit the form
document.forms[formname].submit();
//assign submitTheFormDagnammit to the blank function in case the form
element is not disabled so nothing happens when it is called again
submitTheFormDagnammit= blank;
return false;
}

function blank(formname) {
return false;
} 
</SCRIPT>

then this onclick event in the forms. 

onclick="return submitTheFormDagnammit(this.form);"

I think that my theory is correct, but my syntax may not be, or isnt!

i keep getting the error

document.forms[....].elements is null or not an object

can anyone see my error

mucho appreciatio 

jamo

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to