...

View Full Version : javascript error when files is on server. help!



marianmarian
06-02-2005, 09:52 PM
below is my code; i was able to acheive what i wanted. now the problem is, when i test this locally it works,
but the minute i upload it to the server it gives me a javascript error around here:

"document.myForm.action="test.php?id="+document.myForm.myText.value;" that object does not support this property or method.

but then again when i test locally on my pc, it works fine; on the server i get this error.

i think the assignment of document.myForm.action="someurl.html" is what is giving me errors. any ideas why?

i notice when i comment this "document.myForm.action="test.php?id="+document.myForm.myText.value;" out i get no errors.
but i need the url for it to submit.

the whole idea of the code below is for it to multiple submit in a one form.

help please.

thanks



<html>
<head>
<title>testing</title>

<script type="text/JavaScript">
<!--
function getClientInfo()
{
document.myForm.action="test.php?id="+document.myForm.myText.value;
document.myForm.submit();
}
function processClientInfo()
{
document.myForm.action="test.php?process=process";
document.myForm.submit();
}
-->
</script>

</head>

<body>

<?php
if (isset($_GET['id']))
{
echo "this is a test, print something!";
}
if (isset($_GET['process']))
{
$myText2=$_POST['myText2'];
echo $myText2."this is a test, print process!";
?>
<script language="javascript">
<!--
//location.replace("test.html");
-->
</script>

<?php
}
?>

<br><br>
<form id="myForm" method="post" action="<?php print $_SERVER['PHP_SELF'];?>" name="myForm">
<input type="text" name="myText" onclick="setTimeout('getClientInfo();', 5000);" >
<input type="text" name="myText2" value="">
<INPUT TYPE=button VALUE="SUBMIT" onclick="processClientInfo()" >
</form>
</body>
</html>

marianmarian
06-02-2005, 10:32 PM
i am getting this error only in IE.

the code works fine in netscape. why, anybody knows??

help.

marianmarian
06-02-2005, 10:40 PM
ok solved my own problem.

the reason why it wasn't working in IE was because i had a hidden field with the same name as "action".

damn, took so long to figure it out.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum