Re: Javascript and $_POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On cs, 2007-02-08 at 08:14 -0500, Dan Shirah wrote:
> Okay, I edited my page per some suggestions here.  Below is what I now have:
> 
> 
> <script language="JavaScript">
> function checkForm() {
> 
>  // ** START **
>   if (inputForm.cc_phone_number.value == "") {
>     alert( "Please enter a phone number." );
>     inputForm.cc_phone_number.focus();
>     return;
>   }
> 
> ******Lots of other checks here, just left out for length******
> 
>    document.inputForm.submit();
> }
> 
> </script>
> <title></title>
> <LINK rel="stylesheet" type="text/css" href="../../CSS/background.css">
> </head>
> <body>
> <div align="center"> <h2></h2>
>    <h3>Submit a New Payment.</h3>
> </div>
> <form name="inputForm" action="save.php" method="post"
> enctype="multipart/form-data">
> 
> ******Lots of form data here******
> 
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
>  <tr>
>  <td width="64" align="left"><a href="javascript:checkForm()"
> title="Save">Save</a></td>
>  <td width="616" align="left"><a href="javascript:closeThis()"
> title="Close">Close</a></td>
>  </tr>
> </table>
> </form>
> </body>
> </html>
> 
> Now when I submit my page it still perfroms all of the javascript checks
> correctly, but once it gets to the document.inputForm.submit(); part it
> returns the following error.
> 
> Error: Object doesn't support this property or method.
> Code: 0
> 

maybe because you don't have submit button in the form?
try to include something like this
<input type="image" src="./images/spacer.gif">
where spacer.gif is an 1x1 blank image

I remember some similar situation where it helped, but I'm not sure

hope that helps
Zoltán Németh

> 
> 
> On 2/7/07, Paul Novitski <paul@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > At 2/7/2007 01:34 PM, Dan Shirah wrote:
> > >I have a form that uses Javascript to validate form field entries, and if
> > >they are incorrect it returns an error to the user.
> > >
> > >After the Javascript processing is complete, it submits the form to my
> > save
> > >page. However it seems that once the processing is complete and it passes
> > to
> > >the save page, none of my $_POST variables are being passed.
> >
> >
> > Of course, all of your form fields need to be inside the same
> > <form></form> tags as your submit button.  The sample HTML you posted
> > did not indicate that you'd done this.
> >
> > Regards,
> >
> > Paul
> > __________________________
> >
> > Paul Novitski
> > Juniper Webcraft Ltd.
> > http://juniperwebcraft.com
> >
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux