Re: Javascript and $_POST

From: Date: Thu, 08 Feb 2007 14:09:34 +0000
Subject: Re: Javascript and $_POST
References: 1 2 3 4 5 6 7 8  Groups: php.general 
Request: Send a blank email to php-general+get-248563@lists.php.net to get a copy of this message
Nope, same result unfortunately. On 2/8/07, Németh Zoltán <znemeth@alterationx.hu> wrote:
On cs, 2007-02-08 at 08:56 -0500, Dan Shirah wrote: Okay, I'll try your spacer solution. Where do you think I should add it? I put it right before the </form> tag, but I think you could put it anywhere between the <form> and the </form> greets Zoltán Németh On 2/8/07, Németh Zoltán <znemeth@alterationx.hu> wrote:
        On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
I should not need an actual Button if my link to checkForm()
        ends with
document.inputForm.submit(); which tells the form to submit,
        right?
        well, you should be right...
        but I remember a year ago or so I had a similar problem and
        the image
        input solved it... but I'm not sure whether it was exactly the
        same
        problem or not, so it might be complete bullshit ;)
        greets
        Zoltán Németh
On 2/8/07, Németh Zoltán <znemeth@alterationx.hu> wrote:
        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@juniperwebcraft.com> 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


« previous php.general (#248563) next »