Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript error when files is on server. help!

    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

    Code:
    <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>

  • #2
    New Coder
    Join Date
    Feb 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i am getting this error only in IE.

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

    help.

  • #3
    New Coder
    Join Date
    Feb 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •