POST without FORM? Help... :(
Is it possible in HTTP do action POST without
<form ... method="post">
<input type=file...>
<input type=submit...>
</form>
IE 6.0
[182 byte] By [
randy909] at [2007-11-18 1:59:28]

# 1 Re: POST without FORM? Help... :(
To the best of my knowledge that answer is no. In HTTP there are two standard submission methods FORM and QUERYSTRING. These two collections can be referenced by calling Request in server side ASP or Request.Form, Request.QueryString depending on method for forwarding data.
Anyway to POST you must use a Form unless you post with a QueryString. In that case the variables are passed as part of the url like so.
http://www.here.com/dostuff.asp?DOTHIS=run
In the above example I am passing the variable DOTHIS with the value of run. The server side code could then call Request.QueryString("DOTHIS") to get the value. Thus you could build the query string and pass what you want.
Now another more complicated way is to utilize cookies. (Sorry no example) You can write values to a cookie and then forward the user to another page. The new page then just needs to call the Cookies values to find out if a submission has taken place. This is a lot more complicated and the data will remain on their machine until the cookie expires, deleted or overwritten. If I can find it I may post an example of doing this I played with previously.
# 2 Re: POST without FORM? Help... :(
Realy I have another problem... :(
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title></title>
<script language="JavaScript">
function MyFormSubmit(){nmform.idsubmit.click();}
function SelFile(){idform.idfile.click();}
</script>
</head>
<body>
<form id="idform" name="nmform" action="uploaddo.csp" enctype="multipart/form-data" method="post">
<input id="idfile" type=File name=FileStream></input>
<input id="idsubmit" type=submit>
</form>
<input type="button" value="SetFile" onclick="SelFile();">
<input type="button" value="SendFile" onclick="MyFormSubmit();">
</body>
</html>
Buttons "SetFile" and "SendFile" work...
After that I add to "idform" display=none, press button "SendFile" and see message "Access is denied".
I remove "display=none", press button "SendFile" and...
... see "Access is denied"...
# 3 Re: POST without FORM? Help... :(
I am sorry but I just can't resist myself to ask you why do you want to set "display:none" to a form tag?
It doesn't mean anything different to the interface when we hide a form but surely to the script (I guess)...
Anyway is it necessary to hide the form?
# 4 Re: POST without FORM? Help... :(
It's a very big project.
In this project ALL is doing with common scripts.
Creating toolbars, buttons, etc...
One toolbar in project transfer clients files to and from database.
So I have 2 variants, how to do this:
1. Create this toolbar manualy. (A lot of problems. For example: changing skin of toolbar - skin of project can be changed in ONE place, and so on...).
2. Create hidden form and emulate it clicks/submits by toolbar's button.
:(
# 5 Re: POST without FORM? Help... :(
Got it...
but your code is working fine at my browser (IE5.0/6.0)
<HTML>
<HEAD>
<TITLE></TITLE>
<script language="JavaScript">
function MyFormSubmit(){ nmform.idsubmit.click();}
function SelFile(){ idform.idfile.click();}
</script>
</HEAD>
<BODY id=bdy>
<form id="idform" style="display:none" name="nmform" action="uploaddo.csp" enctype="multipart/form-data" method="post">
<input id="idfile" type=File name=FileStream></input>
<input id="idsubmit" type=submit NAME="idsubmit">
</form>
<input type="button" value="SetFile" onclick="SelFile();" >
<input type="button" value="SendFile" onclick="MyFormSubmit();" >
</body>
</BODY>
</HTML>
# 6 Re: POST without FORM? Help... :(
:(
Realy "Plug&Pray"...
:(:(:(
# 7 Re: POST without FORM? Help... :(
I think the point is that Randy states he added
display=none
but that is not valid syntaxt. Instead look at what Anupam did
style="display:none"
display is a style and this is the proper way to reference it.
# 8 Re: POST without FORM? Help... :(
Yes, style="display:none"
AceHTML do it automaticaly...
# 9 Re: POST without FORM? Help... :(
see "Access is denied"...
Just noticed that was your statement. If this is the problem you are having it sounds lik a permissions problem on the Web Server you are using. Could be for the page, the folder (if subfolder), object whatever your submitting two is not accessible due to permissions.