/    Sign up×
Community /Pin to ProfileBookmark

How do you submit a form multiple times in firefox?

Hi,

Im trying to develop [URL=”http://filesharing.wikidot.com/compare:one-click-hosters-search-engines”]this search form[/URL]. Right now it has the problem that part of the generated query is being ignored by google because they limit their queries to 32 words.

I was thinking to count the words and split the queries and post the form several times to a new window.

Please have a look at the following test code. In IE7 this opens 2 new windows as expected, but in FF both 2 and 3 it only submits the form once.

What am I doing wrong?

[code=html]

<html>
<head>
<title>search box test</title>

<script type=”text/javascript”>

function doIt()
{
document.forms.searchForm.submit();
document.forms.searchForm.submit();
}

</script>
</head>

<body>
<form name=”searchForm” action=”http://www.google.com/search” target=”_blank”>

<input name=hl type=hidden value=en>
<input type=hidden name=q title=”Google Search” value=””>
<input maxlength=2048 name=lineEdit size=70 title=”Google Search” value=””>
<input type=”button” name=”btnG” value=”Google Search” onclick=”doIt()” >
</form>
</body>
</html>

[/code]

ps: i first thought FF protects against accidental double submission, but if you change the text in the search box in javascript, it still doesn’t work. Manually clicking the button twice works as expected.

thx in advance for your help.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@shakeukJun 22.2008 — how about a simple time delay?

[code=html]
<script type="text/javascript">


function doIt()
{
function submitIt(){
document.forms.searchForm.submit();
}
submitIt();
setTimeout(submitIt,100);
}

</script>
[/code]


let me know fi this works.
Copy linkTweet thisAlerts:
@rootJun 22.2008 — Why not just use something like AJAX to do the submit query and control the return data?
Copy linkTweet thisAlerts:
@formauthorJun 22.2008 — Hi,

on the ajax, it's a lot more work, and also this search box is in an iframe on wikidot, where i don't have complete control. It fits in with the flow of the rest of this website, and the end up with google results there would not be really great i think.

On the timeout, that works, most of the time at least. When i first tried, it only opened one. Then increased the delay, and it worked, i started decreasing the delay again and it kept working even at 100 ms. Kind of freaky this sometimes functionality. I wonder what mozilla's reasoning is?

I suppose it is an acceptable method if all else fails though. Better than nothing.

Thanx
×

Success!

Help @form spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...