Re: Simultaneous post/get?
| From: | tedd | Date: | Sun, 11 Jun 2006 15:24:51 +0000 |
| Subject: | Re: Simultaneous post/get? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237761@lists.php.net to get a copy of this message | ||
At 3:21 PM +0100 6/11/06, Stut wrote:
>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
-Stut:
Great suggestion, but I think an "upload file" a different critter.
http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html
For example, I took my above code and changed it like so --
<form method="post" enctype="multipart/form-data"
onSubmit="javascript:sndReq()">
<input type="file" name="image" value="30000">
<input type="hidden" name="stage" value="1">
<input type="submit" value="submit">
</form>
-- and the result was the same. The file uploaded, but nothing happened.
I also took the code you referenced, exactly "as-was" and I changed the <FORM statement
to --
<form method="post" enctype="multipart/form-data" onSubmit="return
TestDataCheck()">
-- and it didn't work the way one would expect either.
Apparently, the "built-in" upload-file thing has it's own way of processing events.
What do you think?
Thanks for your time.
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com