Submit via ASP Code

I have an intermediate page that takes a querystring, does a query on a
database and writes out hidden values for each returned record. This design
layout is necessary for a variety of reasons and not subject to change.

I need the form to never be seen, essentially it needs to write out the
hidden values and immediately post to another form when it's done. I have
everything accomplished but the posting. Is there a technique to post the
form via code as opposed to a submit button or something of that nature?

"James Baker" <> wrote in message
news:O5b6Z##...
> I have an intermediate page that takes a querystring, does a query on a
> database and writes out hidden values for each returned record. This
design
> layout is necessary for a variety of reasons and not subject to change.
>
> I need the form to never be seen, essentially it needs to write out the
> hidden values and immediately post to another form when it's done. I have
> everything accomplished but the posting. Is there a technique to post the
> form via code as opposed to a submit button or something of that nature?
>
> Thanks,
> James
>
>

Advertisements

You can always write a little javascript code at the end of the file (or on
onload) that would simply call the click event of the submit button like
this:

document.getElementById('submitBtn').click();

I am confused why you have to go back to the client at all if you are not
allowing them to do anything with the values.

"James Baker" <> wrote in message
news:O5b6Z%23%...
> I have an intermediate page that takes a querystring, does a query on a
> database and writes out hidden values for each returned record. This
design
> layout is necessary for a variety of reasons and not subject to change.
>
> I need the form to never be seen, essentially it needs to write out the
> hidden values and immediately post to another form when it's done. I have
> everything accomplished but the posting. Is there a technique to post the
> form via code as opposed to a submit button or something of that nature?
>
> Thanks,
> James
>
>

I'm with the others and would ask my favorite of all questions - What
are you trying to accomplish? Just because one particular design was
initially utilized, doesn't mean that it was the best possible design
for the problem. If the design layout is neccessary as you say, please
share the specifics with us as to why its neccessary.

David H

James Baker wrote:
> I have an intermediate page that takes a querystring, does a query on a
> database and writes out hidden values for each returned record. This design
> layout is necessary for a variety of reasons and not subject to change.
>
> I need the form to never be seen, essentially it needs to write out the
> hidden values and immediately post to another form when it's done. I have
> everything accomplished but the posting. Is there a technique to post the
> form via code as opposed to a submit button or something of that nature?
>
> Thanks,
> James
>
>

Vance Kessler wrote:
> I am not exaclty sure what you are trying to do here but...
>
> You can always write a little javascript code at the end of the file
> (or on onload) that would simply call the click event of the submit
> button like this:
>
> document.getElementById('submitBtn').click();
>
Why bother with that? Just

document.forms(0).submit();

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

What every one including myself is concerned with is that you are trying to
post info to the server that you already have on the server

what ever is done with that info when it is submitted should be done on the
the page you want to resubmit

but anyway, ill show you want you need, but i think it is teh wrong way to
go about it

put this at the end of the page
<SCRIPT LANGUAGE=javascript>
document.forms(0).submit()
</SCRIPT>

"James Baker" <> wrote in message
news:O5b6Z##...
> I have an intermediate page that takes a querystring, does a query on a
> database and writes out hidden values for each returned record. This
design
> layout is necessary for a variety of reasons and not subject to change.
>
> I need the form to never be seen, essentially it needs to write out the
> hidden values and immediately post to another form when it's done. I have
> everything accomplished but the posting. Is there a technique to post the
> form via code as opposed to a submit button or something of that nature?
>
> Thanks,
> James
>
>

Actually, now that I think about it - If you're concerned abou t the
amount of work neccessary to alter things so that a page isn't sent to
the client, it shouldn't be that difficult. All it should take is
putting the ASP for both pages on the same page and then altering the
code to store/retrieve the values in variables or an array. You'll be
using the variables for what they were intended for (to store
information) which is what you're using the form fields for.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!