Re: Simultaneous post/get?

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

 



tedd wrote:
I am trying to use ajax to accomplish this.

The following statement works great and does what I want:

<input type="submit" value="Submit" onClick="javascript:sndReq()" >

However, when I place the statement within a form, like thus --

<form method="post" enctype="multipart/form-data"> <input
type="hidden" name="MAX_FILE_SIZE" value="30000"> <input
type="hidden" name="stage" value="1"> <input type="submit"
value="Submit" onClick="javascript:sndReq()" > </form>

-- the statement appears to no longer work.

The form is being submitted to the current URL which will stop any javascript executing at the time. What you need to do is prevent the form from being submitted, or control when it is submitted. Instead of using the onclick attribute on the button you should be using the onsubmit attribute in the form tag to control this. Fairly good explanation of this here:

    http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html

-Stut

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