Fog Creek Software
Discussion Board

How would you silently submit a form?

I'm working in ASP, but I don't think the platform matters...

I want to pre-fill some form fields and submit them to another page (that will recognize them) without using an actual form--just server-side script without the client knowing. How would you create a request that was more than just the URL but also contained the values? I could swear I've seen it done before, but Google isn't telling me.

This is possible, isn't it?

Thursday, July 29, 2004

Code Monkey
Thursday, July 29, 2004

function body_onload()
<body onload="body_onload()">
<form action="SomePage.asp" name="theForm">
  <input type="hidden" name="val1" value="something">
  <input type="hidden" name="val2" value="something">
  <input type="hidden" name="val3" value="something">

Duncan Smart
Thursday, July 29, 2004

One nifty little trick I use is having a 0 sized iframe which actually holds a copy of my form.  Then, whenever someone edits a text box in the main form, a value is updated in the iframe form.

Then, when the last box is populated or a mouseover happens, I submit the iframe form.  It is totally invisible and this is how I do all my searching in our apps.

It's a hack that gives you a multi-threaded web app.

Friday, July 30, 2004

Thanks for the replies, but they're all client side solutions. I was talking about preparing a request server-side, and submitting it to another page (the other page is on another site, actually!).

But perhaps the on_load method is the only way.

Friday, July 30, 2004


As this tutorial demonstrates, you can access another URL in your ASP code using InetCtrls.Inet:

While this is mainly used to fetch stuff from other servers, you can also include a querystring in your request to pass information.

Ged Byrne
Friday, July 30, 2004

Still not useful to fake a form submit.

But I did find this, which I think will do the job:

How To Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object:;EN-US;Q290591&ID=KB;EN-US;Q290591

Friday, July 30, 2004

Teller, there's no reason to get the client to do that post for you if you'd rather not.

It sounds like you want something like this:

Client <--> Server A <--> Server B

But other people are describing this:

Server A <--> Client <--> Server B

Depending on the languages and libraries you have access to, you ought to be able to submit the POST request to Server B from Server A directly.  It's easy enough that you can do it if you just have access to a socket library.

Friday, July 30, 2004


Exactly. I guess I was hoping I wouldn't have to hack the http protocol to get it done. On the bright side, it is my understanding that form element and values are just more text, name/value it shouldn't be to horribly hard to figure out.

Thanks everyone...

Friday, July 30, 2004

Wow Teller, you're a moron.

Tuesday, August 3, 2004

*  Recent Topics

*  Fog Creek Home