On Wed, 1 Dec 2004 09:22:49 +0200, "J. J. Cale" <ph****@netvision.net.il> wrote:
"Don" <no@adr.com> wrote in message
news:mg********************************@4ax.com.. . On Wed, 1 Dec 2004 07:11:06 +0100, "Ivo" <no@thank.you> wrote:
>"Don" <no@adr.com> asks
>> I have a need to submit a form, but don't need the user to click on a
>button. How do I do this? Is
>> there some way, using JavaScript, to setup a <form> tag to do this?
>>
>> Thanks,
>> Don
>>
>The question is of course what way the user (or some 'backgroundprocess') >should submit your form in your alternative scenario. Onload of thewindow? >Onkeypress anywhere? Anyhow you are probably going to use the notorious
>submit() method in some form or other. Like so:
>
><script type="text/javascript">
> document.forms[0].submit();
></scipt>
>
>Submitting a form destroys the existing page and loads a new one from the
>server. It is impossible to submit multiple forms or perform any action
>after submit() has been called.
>Depending on the contents of the form elements, some confirmation dialog
>browser windows may be unavoidable before the final Submission.
>
>HTH
I'm not sure I follow you here. I don't want any user intervention. Yet,
I want to submit the <form> to the server PHP script. The script that submit's the <form> will
be doing some data manipulation, but there's no need for the user to have to click on
anything. When the data manipulation is done I want a <form> to be submitted to another
server-side PHP script.
Don
As Ivo explains this is easy enough to do but there are things you should
consider in addition to his remarks.
When the form is submitted the clients page WILL be refreshed!!! Even if
you put everything back this could be very annoying! Especially since the
user will not be expecting it.
I suggest you post some code and explain what you are doing; tracking user
actions, tracking internal link usage, or just validating form data and
submitting when you have enough info or whatever. Be more specific and you'l
l be pointed in the right direction.
Jimbo
I have a erver-side PHP script that processes possible upload files, and also prepares some <input>
tags from data sent by the client-side page that invoked this PHP script. If there were any
uploaded files I print a message indicating the upload was successful, and I want the user to have
time to read the message. Therefore, I want him to click on a "continue" button. However, if there
were no uploads, I still want to do some <input> tag preparation from data sent by the invoking
page, but don't need to display anything, and don't need the user to click on a button. In either
case, the <form> tag has the same "action" element. Just want a button in one case, and not in the
other. How do I go about this?
Thanks for your help, both of you guys.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---