Bug 101340 - javascript form submit does not work
Summary: javascript form submit does not work
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: 3.5
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-12 00:34 UTC by Joseph Wenninger
Modified: 2012-06-19 17:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
testcase attached (218 bytes, text/html)
2005-06-15 15:20 UTC, Tommi Tervo
Details
Bricklink order form (26.80 KB, text/html)
2005-10-29 12:58 UTC, Jan-Albert van Ree
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Wenninger 2005-03-12 00:34:46 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

My providers's webmail uses submit code like the one below. That works eg in IE, but not with khtml/kjs.

The error kjs error message is:
Error: node : TypeError: Object [object INPUT] (result of expression this.document.s.submit) does not allow calls.

<html>
<body>
<form action="something.php" name="s">
<input type="text" name="what" value="">
<input type="Hidden" name="submitAction" value="">
<a href="javascript:this.document.s.submitAction.value='Suchen';this.document.s.submitAction.name='submit';this.document.s.submit();">Action</a>
</form>
</body>
</html>
Comment 1 Mario Weilguni 2005-04-02 10:14:11 UTC
I would consider this html/js as completly broken, neither Opera nor Firefox seem to support this, maybe this is IE only (did not test yet).

Comment 2 Wilbert Berendsen 2005-05-20 20:21:49 UTC
A variant of this problem is this:

It does not work in Konqueror but it does in Firefox.

<html> 
 <body> 
 <form action="something.php" name="searchForm"> 
 <input type="text" name="what" value=""> 
 <a href="#" onclick="document.forms['searchForm'].submit()">Search</a>
 </form> 
</body> 
</html>

The problem is that Konqueror just goes to "#", and does not submit the form.

This can be seen in the wild on http://www.tvgids.nl/
Searching on this important site currently does not work in Konqueror
Comment 3 Tommi Tervo 2005-06-15 15:20:06 UTC
Created attachment 11464 [details]
testcase attached
Comment 4 Allan Sandfeld 2005-06-16 17:22:44 UTC
SVN commit 426139 by carewolf:

Hack from Webcore to behave like other browsers.
BUG: 101340


 M  +22 -2     khtmlview.cpp  


--- trunk/KDE/kdelibs/khtml/khtmlview.cpp #426138:426139
@@ -3042,11 +3042,31 @@
 						button,0, _mouse, dblclick );
         me->ref();
         targetNode->dispatchEvent(me,exceptioncode,true);
-        if (me->defaultHandled() || me->defaultPrevented())
+	bool defaultHandled = me->defaultHandled();
+        if (defaultHandled || me->defaultPrevented())
             swallowEvent = true;
         me->deref();
 
-        if (eventId == EventImpl::MOUSEDOWN_EVENT) {
+	// Special case: If it's a click event, we also send the KHTML_CLICK or KHTML_DBLCLICK event. This is not part
+	// of the DOM specs, but is used for compatibility with the traditional onclick="" and ondblclick="" attributes,
+	// as there is no way to tell the difference between single & double clicks using DOM (only the click count is
+	// stored, which is not necessarily the same)
+	if (eventId == EventImpl::CLICK_EVENT) {
+	    me = new MouseEventImpl(dblclick ? EventImpl::KHTML_ECMA_DBLCLICK_EVENT : EventImpl::KHTML_ECMA_CLICK_EVENT,
+				    true,cancelable,m_part->xmlDocImpl()->defaultView(),
+				    detail,screenX,screenY,clientX,clientY,pageX,pageY,
+				    ctrlKey,altKey,shiftKey,metaKey,
+				    button,0, _mouse, dblclick);
+
+	    me->ref();
+	    if (defaultHandled)
+		me->setDefaultHandled();
+	    targetNode->dispatchEvent(me,exceptioncode,true);
+            if (me->defaultHandled() || me->defaultPrevented())
+                swallowEvent = true;
+	    me->deref();
+        }
+        else if (eventId == EventImpl::MOUSEDOWN_EVENT) {
             // Focus should be shifted on mouse down, not on a click.  -dwh
             // Blur current focus node when a link/button is clicked; this
             // is expected by some sites that rely on onChange handlers running
Comment 5 Maksim Orlovich 2005-06-25 22:32:46 UTC
Don't see how the fix relates to the original request -- it only relates to comment #2. Jowenn: a bit more of the html may be relevant. In particular, does the form have an element by the name of submit?
Comment 6 Jan-Albert van Ree 2005-10-29 12:58:33 UTC
Created attachment 13204 [details]
Bricklink order form

Another form where it's impossible to submit your selection. Doesn't work in
Konqueror 3.4.92, however it DID work in 3.4.0 and works fine in Firefox and
other browsers.
Comment 7 Maksim Orlovich 2005-10-29 16:10:28 UTC
Please do not add in unrelated bug reports like that, but rather file a separate report. (In fact, your issue is likely a parser bug, but it needs reduction; but it's entirely unrelated to this)

Comment 8 Mario Weilguni 2007-05-03 15:58:19 UTC
Works fine with 3.5.6, can this report be closed?
Comment 9 Alexander Rødseth 2008-01-30 15:06:18 UTC
Does not work in KDE 4, try this page:
http://pouet.net/prodlist.php
Comment 10 Maksim Orlovich 2008-01-30 17:44:22 UTC
Re: comment #9 --- please see my comment #7
Comment 11 Janek Bevendorff 2012-06-19 17:46:29 UTC
Closing as fixed as of comment #7 and comment #8.
If you still thing this issue is valid for Konqueror 4.8.4 or later, please file a new report.
Thanks for your understanding.