homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Browsers / Firefox Browser Usage and Support
Forum Library, Charter, Moderators: incrediBILL

Firefox Browser Usage and Support Forum

Problem across browsers in submitting form through Javascript

 12:27 pm on May 21, 2007 (gmt 0)

I am submitting a form using javascript code document.formname.submit()

It works fine in IE but the other browsers are not supporting this feature. I have tried Firefox, Netscape and Opera. The Javascript Error Console in Firefox and Netscape showed error on that very line.

Have anyone got any idea. I searched google but thats a real waste of time.....



 4:47 pm on May 21, 2007 (gmt 0)

First, I'd say validate your html against the doctype you are using to find any missing close tags or other true errors. Also try document.forms.formname.submit() - that might make a difference.


 8:40 am on May 22, 2007 (gmt 0)


No result. I have also tried document.getElementById('f1').submit() where f1 is the id of the form.

Can anyone help me out?


 1:56 pm on May 22, 2007 (gmt 0)

What about :


 5:36 am on May 23, 2007 (gmt 0)

It works. But my purpose has not solved yet. I want to store some values in hidden fields in a form and submit it automatically when I call the form submitting function. My code is:
<form name="f1" action="search_cdr_result.php" method="post">
<input type="hidden" name="sDate" value="<?php echo($sDate);?>">
<input type="hidden" name="eDate" value="<?php echo($eDate);?>">
<input type="hidden" name="phone" value="<?php echo($phone);?>">
<input type="hidden" name="flag" value="2">
<script language="JavaScript">
function submitform()

Any suggestion? I can pass the values as:

But when the number of variables increases its hard to maintain.


 5:37 am on May 23, 2007 (gmt 0)

You need to have a SUBMIT type INPUT element to automatically sumbit the form in many browsers.

<input type="submit" style="width:0px;height:0px" value="">

Something like that should work fine.

For passing lots of variables, consider using an array... <input name="something[]" type="hidden" value="1">
<input name="something[]" type="hidden" value="2">
<input name="something[]" type="hidden" value="3">

That gives you, on your server side, something[0], something[1], something[2]


 2:01 pm on May 24, 2007 (gmt 0)

All form elements values are transmited on submit, even hidden fields. What is you problem?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Browsers / Firefox Browser Usage and Support
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved