473,324 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Multiple Form Post Using Javascript - Empty Post from FF

Hey,

I'm using JS to submit a form with image submit buttons, using the
following code...

(Page is here... http://www.cards2do.co.uk/addcard.php?card_id=292 )

************************************************** ************************************

<form action="https://www.cards2do.co.uk/addcard.php" method="post"
id="loginform">
Username:

..................... Rest of Form.....................

<input type="hidden" name="submit" value="true"/>
<input type="image" src="images/buttons/login.gif" alt="Click To Login"
onclick="javascript:document.loginform.submit();"/>
</form>

************************************************** ************************************

There are two forms on this particular page... They use identical code
except that the second form has a different name (also updated in the
onclick event), and the dummy submit variable has a different name to
help the PHP.

The problem...
Everything works perfectly in IE... both the user login and the "adding
card" form work great.
However in Firefox... the login works perfectly but the "adding card"
form does not. Using the PHP function "var_dump($_POST)" hsa shown me
that the post from firefox is a totally null array. No keys or values
are present at all. Firefox reported no Javascript errors in the
console when I ran it.

I would be extremely grateful if anyone knows the cause of the problem.
I would assume it's my Javascript rather than Firefox! : )

Many Thanks,

Adam King
Cards2do.co.uk

Nov 23 '05 #1
8 5703
vdP
Adam wrote:
Hey,

I'm using JS to submit a form with image submit buttons, using the
following code...

(Page is here... http://www.cards2do.co.uk/addcard.php?card_id=292 )

************************************************** ************************************

<form action="https://www.cards2do.co.uk/addcard.php" method="post"
id="loginform">
Username:

.................... Rest of Form.....................

<input type="hidden" name="submit" value="true"/>
<input type="image" src="images/buttons/login.gif" alt="Click To Login"
onclick="javascript:document.loginform.submit();"/>
</form>

************************************************** ************************************
The problem...
Everything works perfectly in IE... both the user login and the "adding
card" form work great.
However in Firefox... the login works perfectly but the "adding card"
form does not. Using the PHP function "var_dump($_POST)" hsa shown me
that the post from firefox is a totally null array. No keys or values
are present at all. Firefox reported no Javascript errors in the
console when I ran it.


Surprisingly, my Firefox showed the following error after submitting the
form.

Error: document.loginform has no properties
Source File: https://www.cards2do.co.uk/addcard.php
Line: 1

To solve the problem replace the onclick attribute in the submit image
to onclick="javascript:document.getElementByID('login form').submit();" .
That should work in Firefox and IE.

vdP
Nov 23 '05 #2
Brilliant... Thanks for your help guys, I will try out your suggestions
tomorrow and let you know!

Cheers,
Adam

Nov 23 '05 #3
Hey,

I tried out both your suggestions but still no luck! Firefox still
sends empty posts for only the "add card" form on the page. It says
that document.getElementByID is not a function.. (I tried different
capitalisations of the function name just in case)

Do you guys have any other thoughts?

Cheers for your help so far!
Adam

Nov 23 '05 #4
Adam wrote:
I tried out both your suggestions but still no luck! Firefox still
sends empty posts for only the "add card" form on the page. It says
that document.getElementByID is not a function.. (I tried different
capitalisations of the function name just in case)


You did not try `document.getElementById'. And

<input type="image" ...
onclick="javascript:document.getElementbyId('infof orm').submit();"/>

is nonsense.

1. `javascript:' is nonsensical where supported as designed
(to generate an HTML document from script code; the submit()
method returns `undefined') and error-prone when not supported.
Omit that and add

<meta http-equiv="Content-Script-Type" content="text/javascript" />

to the `head' element.

2. The `input' element is descendant of the `form' element referred to.
If it were not already a submit control, that form element could be
easily referred to by `this.form'. No need for getElementById()
and the like.

3. input[type="image"] are submit controls, there is no need for scripting.

4. <http://hixie.ch/advocacy/xhtml>
HTH

PointedEars
Nov 23 '05 #5
Thanks Thomas...

I implemented the code vdP recommended to the letter. That was the
output Firefox gave in the console.

I tried removing the "onclick" attribute all together...
Unfortunately... still the same problem! IE is happy with the login and
the "addcard" form, but Firefox only posts the login form.

Your point number 4... I had a browse through that page, are you saying
you think the problem was due to the pages being served as text/html
MIME type? (or something along those lines?)

So with the page now using no JS to submit the forms, the problems
remain! : (

I'm still totally clueless about this one... any more ideas? : )

Thanks,
Adam

Nov 23 '05 #6
Adam wrote:
I implemented the code vdP recommended to the letter. That was the
output Firefox gave in the console.
"That"? <URL:http://www.jibbering.com/faq/faq_notes/pots1.html>
I tried removing the "onclick" attribute all together...
Unfortunately... still the same problem! IE is happy with the login and
the "addcard" form, but Firefox only posts the login form.
Clear your cache, then try again. If it still does not work, and there is
no JS code whatsoever left, most certainly you do not have a JS problem.
Your point number 4... I had a browse through that page, are you saying
you think the problem was due to the pages being served as text/html
MIME type? (or something along those lines?)
Possibly.
So with the page now using no JS to submit the forms, the problems
remain! : (
Maybe you are assigning an event listener somewhere else or a buggy
extension interferes.
I'm still totally clueless about this one... any more ideas? : )


Not without more/the entire source code, preferably provided through a URL.
PointedEars
Nov 23 '05 #7
On 2005-11-21, Adam <bu**************@gmail.com> wrote:
The problem...
Everything works perfectly in IE... both the user login and the "adding
card" form work great.
However in Firefox... the login works perfectly but the "adding card"
form does not. Using the PHP function "var_dump($_POST)" hsa shown me
that the post from firefox is a totally null array. No keys or values
are present at all. Firefox reported no Javascript errors in the
console when I ran it.


There's probably something wrong with the HTML.

http://validator.w3.org/check?uri=ht...Fcard_id%3D292

claims there are 12 somethings.
--

Bye.
Jasen
Nov 24 '05 #8
Thank you Jasen!

It was an xhtml error... (missed a closing tag). Guess IE blindly
ignored it, while Firefox was (rightly) getting confused. So it's all
working now. I'll use the validator more in future!
Thanks for your help...
Adam

Nov 24 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
7
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
2
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
5
by: Charlie King | last post by:
I'm trying to send data to a remote script (a credit card processing third party) from my site using POST. Currently, I'm doing it using the ususal form dynamically built with my values. This...
5
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
17
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get the value of a form control? -----------------------------------------------------------------------...
4
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. ...
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
1
by: lolcat | last post by:
Hi guys, new here and to javascript, I have this form that I am trying to you javascript to validate the multiple input text boxes. form as follows <form action="login.php" method="post"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.