Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Firefox Javascript Problem
Old 03-15-2006, 05:48 PM Firefox Javascript Problem
efriese's Avatar
Average Talker

Posts: 21
Location: Auburn, AL
Trades: 0
Does anyone know why this doesn't work in firefox?

Code:
	  <SCRIPT LANGUAGE="Javascript">
	<!--
	document.forms("form1").submit()
	//--></SCRIPT>
It works fine in IE. I'm trying to automatically submit an HTML form. Does anyone know any alternatives that will work in both IE and Firefox?

Thanks in advance!
__________________
Find E-Commerce Discussions and Resources at
Please login or register to view this content. Registration is FREE
efriese is offline
Reply With Quote
View Public Profile Visit efriese's homepage!
 
 
Register now for full access!
Old 03-15-2006, 06:01 PM Re: Firefox Javascript Problem
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I think what you want is document.forms["form1"].submit();

Brackets [] around "form1" and not parenthesis ()
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-15-2006, 06:09 PM Re: Firefox Javascript Problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
document.forms["form1"].submit()
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-15-2006, 06:51 PM Re: Firefox Javascript Problem
efriese's Avatar
Average Talker

Posts: 21
Location: Auburn, AL
Trades: 0
I tried changing it, but it still doesn't work in firefox. Any other ideas?
__________________
Find E-Commerce Discussions and Resources at
Please login or register to view this content. Registration is FREE
efriese is offline
Reply With Quote
View Public Profile Visit efriese's homepage!
 
Old 03-16-2006, 12:29 AM Re: Firefox Javascript Problem
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Could you post more of the code or a link to the page? Seeing the rest of the code would help in being able to figure out what's going on. Thanks.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-16-2006, 09:35 AM Re: Firefox Javascript Problem
efriese's Avatar
Average Talker

Posts: 21
Location: Auburn, AL
Trades: 0
Code:
<html>
<form method="post" id="form1" name="form1" action="https://payments.verisign.com/payflowlink">
<input type="hidden" name="LOGIN" value="">
<input type="hidden" name="PARTNER" value="Verisign">
<input type="hidden" name="AMOUNT" value="">
<input type="hidden" name="TYPE" value="S">
</form>
	  <SCRIPT LANGUAGE="Javascript">
	<!--
	document.forms["form1"].submit()
	//--></SCRIPT>
</html>
That's all of the HTML...minus the login information. I can't really give a link to the page yet. Can anyone see a reason why that Javascript code doesn't work with firefox?
__________________
Find E-Commerce Discussions and Resources at
Please login or register to view this content. Registration is FREE
efriese is offline
Reply With Quote
View Public Profile Visit efriese's homepage!
 
Old 03-16-2006, 12:59 PM Re: Firefox Javascript Problem
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I'm not seeing anything obvious. You could try using document.form1.submit() and access the form directly instead of going through the forms array to see if that will work.

Usually when I've used code like you have in the javascript I've placed it in the head of the document instead of in the body. Not sure it should make a difference, but easy enough to see if it works that way.

Just curious about why you want this to be automatically submitted. Wouldn't this be the kind of thing you would submit once a visitor to your site has agreed to purchase somethng? Is there a reason why you can't just use a normal submit button?
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-16-2006, 04:16 PM Re: Firefox Javascript Problem
efriese's Avatar
Average Talker

Posts: 21
Location: Auburn, AL
Trades: 0
I tried that...but it still didn't work. The reason why I'm doing that is because I'm sending that data to the payment processor after doing a some actions in PHP before that. I didn't know a better way of sending that data when it has to be sent by a POST action.
__________________
Find E-Commerce Discussions and Resources at
Please login or register to view this content. Registration is FREE
efriese is offline
Reply With Quote
View Public Profile Visit efriese's homepage!
 
Old 03-16-2006, 04:55 PM Re: Firefox Javascript Problem
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
That makes sense.

It looks to me like your html and javascript are correct. I tried an experiment where I took your code, changed the value for the action and loaded the page locally using Firefox. It seemed to work for me so I'm thinking that it's not this code causing the problem.

What happens when you use Firefox? Does the page go to verisign at all and just not work or does it stay on the page itself?
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-17-2006, 02:54 AM Re: Firefox Javascript Problem
efriese's Avatar
Average Talker

Posts: 21
Location: Auburn, AL
Trades: 0
It doesn't go to Verisign, it just sits there with a blank page. Pretty puzzling...
__________________
Find E-Commerce Discussions and Resources at
Please login or register to view this content. Registration is FREE
efriese is offline
Reply With Quote
View Public Profile Visit efriese's homepage!
 
Old 03-17-2006, 11:26 AM Re: Firefox Javascript Problem
trendybox's Avatar
Experienced Talker

Posts: 42
Trades: 0
maybe try a numerical reference to the form instead of calling it by name:

Code:
 
document.forms[0].submit()
__________________
-[Trendy Box]-

Please login or register to view this content. Registration is FREE

trendybox is offline
Reply With Quote
View Public Profile Visit trendybox's homepage!
 
Old 03-17-2006, 01:45 PM Re: Firefox Javascript Problem
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
That is strange efries. Like I said I copied your code above and just replaced the action of the form to point to another file which I created. When I loaded the page with your code it went right to my second page which is making me think the problem isn't with this code, but something else.

I just tried it again with the form action pointing to verisign and it worked as well. I get a data error page at verisign asking for the login name and the value for the amount.

I'm using Firefox 1.5.0.1

I think the problem is something other than the javascript or the html for the form. Maybe something else on the page is causing the problem. Is there more of the page you could post? I'd be happy to take a look.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-17-2006, 04:58 PM Re: Firefox Javascript Problem
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Try just putting

Code:
alert("I got here");
And see if it runs. Or try putting the code into a function, and run it on onload.

In <head>:
Code:
function submitForm()
{
    document.forms["form1"].submit();
}

window.onload = submitForm;
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 03-24-2006, 02:04 AM Re: Firefox Javascript Problem
Super Talker

Posts: 144
Trades: 0
perhaps because you don't have the BODY tag, and FF can't reference the document?

<html>
<head>
<title>title to page</title>
</head>

<body>

code here

</body>
</html>
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-25-2006, 01:26 PM Re: Firefox Javascript Problem
ermau's Avatar
Experienced Talker

Latest Blog Post:
Chopper pwnage
Posts: 47
Name: Eric
Location: Florida
Trades: 0
Yes, proper HTML might help.
__________________
PHP / mySQL Developer
ermau is offline
Reply With Quote
View Public Profile
 
Old 10-18-2006, 09:49 PM Re: Firefox Javascript Problem
jjt
Junior Talker

Posts: 1
Name: Jacinta
Trades: 0
did you find a solution to this?
i am having a similar problem with an asp.net form. works fine in IE but just posts back to the same page in Firefox. Here is the code:

if(typeof(delayPostBack == 'function'))
{

if(navigator.userAgent.indexOf("Firefox") != -1)
{
var theform = document.forms["Form1"];
var eventTarget = "ImageButton";
theform.__EVENTTARGET.value = eventTarget.split("$").join(":"); theform.submit();
}
else
{delayPostBack();}
}
jjt is offline
Reply With Quote
View Public Profile
 
Old 10-19-2006, 02:17 AM Re: Firefox Javascript Problem
seomumbai's Avatar
Skilled Talker

Posts: 98
Trades: 0
I think ther insted of [] these u have to give ().
seomumbai is offline
Reply With Quote
View Public Profile
 
Old 01-31-2007, 07:40 PM Re: Firefox Javascript Problem
Junior Talker

Posts: 2
Name: David Joshua Rodman
Trades: 0
Well -- rather than struggle with Firefox, if you're in PHP already and need to POST to Verisign, I'd suggest using curl. That way you're doing it all within the PHP program, and you're not in any way dependent on browser capabilities or settings. Here's a fairly general function you can use:
/**
* grab a page from the given site, posting the given fields
* if no fields, no POST, just get the page.
*/
function grab_page($site, $fields = '')
{ $cfd = curl_init();
$qstring = '';
if(is_array($fields))
{ $first = true;
$qstring = '';
foreach($fields as $K => $V)
{ if($first)
$first = false;
else
$qstring .= '&';
$qstring .= "$K=$V";
}
}

curl_setopt($cfd, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($cfd, CURLOPT_URL, $site);
curl_setopt($cfd, CURLOPT_RETURNTRANSFER, 1);
if(!empty($qstring))
{ curl_setopt($cfd, CURLOPT_POST, 1);
curl_setopt($cfd, CURLOPT_POSTFIELDS, $qstring);
}
curl_setopt($cfd, CURLOPT_COOKIEJAR, 'cr_cookies.txt');
curl_setopt($cfd, CURLOPT_COOKIEFILE, 'cr_cookies.txt');
$result = curl_exec($cfd);
curl_close($cfd);
return $result;
}
djrodman is offline
Reply With Quote
View Public Profile
 
Old 02-01-2007, 05:22 AM Re: Firefox Javascript Problem
Skilled Talker

Posts: 96
Name: Tudor Barbu
Trades: 0
Code:
<script type="text/javascript">
    submitThyForm = function( 'form_id' ) {
        document.getElementById( 'form_id' ).submit();  
    }
    // the form must have an ID
    // <form action="foo.php" method="post" id="form_id">
    // if you want it without an id
    // try
    submitThyForm = function( 'form_id' ) {
        document.getElementsByTagName( 'form' )[0].submit();  
    }
</script>
__________________

Please login or register to view this content. Registration is FREE
Tudor.b is offline
Reply With Quote
View Public Profile Visit Tudor.b's homepage!
 
Old 02-02-2007, 06:49 AM Re: Firefox Javascript Problem
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
solved?
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Reply     « Reply to Firefox Javascript Problem

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.54482 seconds with 12 queries