[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Why doesn't this work?
From:       Michael Pyne <pynm0001 () comcast ! net>
Date:       2005-04-27 5:43:33
Message-ID: 200504270143.36492.pynm0001 () comcast ! net
[Download RAW message or body]


I'm trying to submit a form with Javascript.  It doesn't seem to work right in 
Konqueror for some reason (KHTML CVS).

Sample code:
<html>
<head>
<script language="javascript1.1">
<!--
function submitAction(prog)
{
    /* The following HTML has the appropriate form element with
     * name = "reqForm"
     */
    if(!document.reqForm)
    {
	window.alert("reqForm not found");
	return;
    }

    document.reqForm.reset();
    document.reqForm.program_id.setAttribute("value", prog);
    document.reqForm.submit(); /* Nothing doing. :( */
}
-->
</script>

</head>
<body>
<form name="reqForm" method="post" action="$script_name">
<input name="request" type="hidden" value="edit"/>
<input name="program_id" type="hidden" value="-1"/>
</form>

<!-- Listing of various programs follows, example: -->
<a href="#" onClick="submitAction(1)">Program 1</a><br>
<a href="#" onClick="submitAction(2)">Program 2</a><br>
</body>
</html>

Basically what I'm trying to do is write a frontend for my personal use, which 
just displays a list of hyperlinked programs (generated via CGI script), 
which, when clicked, just runs the script again, but with the appropriate 
form variables filled out.

This works in Firefox 1.0.3, as did an alternate technique I tried of creating 
the form and the input elements dynamically.  Neither method seems to work in 
KHTML.  Instead of going to the specific page for the program, KHTML either 
reloads the page it was on (listing of programs), or goes back to the default 
page that is displayed when the user first runs the script. :(

I'd appreciate any advice/pointers.

Regards,
 - Michael Pyne

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic