Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Curious : Form processing using plain HTML

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
At most times I am using serverside code, or applications to process a form submission but I was curious, since forms is a part of standard HTML, how does standard html decode or process a form submission? (or any clientside method for that matter) Karl Blessing aka kb244{fastHACK}
kblogo.jpg
 
if i understood u right, u mean javascript function, smth like onsubmit="somefunction()" wich will validate the values in ur form? regards, vic
 
no I mean actually processing it, for example, if I had

(a basic way of how I would generally do it)
Code:
<Form action=&quot;somewhere.asp&quot; method=&quot;post&quot;>
  <input type=&quot;hidden&quot; name=&quot;yname&quot; value=&quot;karl&quot;>
  <input type=&quot;text&quot; name=&quot;ytext&quot;>
  <input type=&quot;submit&quot; value=&quot;Send info&quot;>
</form>

then on the somewhere.asp I would do

Code:
...
<%
Response.write &quot;<Center> Hello &quot; & Request.Form(&quot;yname&quot;) & &quot; how are you </center>&quot; & vbcrlf & &quot;<BR>&quot;
Response.write &quot;you typed in : &quot; & Request.Form(&quot;ytext&quot;)
...
%>

question is, in regular HTML or javascript, how do I process information sent to a page. Rather than using Request.Form of a serverside language. Karl Blessing aka kb244{fastHACK}
kblogo.jpg
 
Hello,
Vitus is right.
Some examples to play with:
<HTML>
<HEAD>
<TITLE> Simple HTML Form </TITLE>
<script language=&quot;JavaScript&quot;>
function somefunction(){
alert(document.forms[0].yname.value);
alert(document.forms[0].ytext.value);
alert(document.forms[0].elements[2].value);
}
</script>
</HEAD>

<BODY>
<Form method=&quot;post&quot; enctype=&quot;text/plain&quot; onsubmit=&quot;somefunction()&quot;>
<input type=&quot;hidden&quot; name=&quot;yname&quot; value=&quot;karl&quot;>
<input type=&quot;text&quot; name=&quot;ytext&quot;>
<input type=&quot;submit&quot; value=&quot;Send info&quot;>
</form>
</BODY>
</HTML>


or using action=mailto

<Form action=&quot;mailto:you@some.com&quot; method=&quot;post&quot;>
will send query string yname=karl&ytext=test to specified e-mail.

or
<Form action=&quot;mailto:you@some.com&quot; method=&quot;post&quot; enctype=&quot;text/plain&quot;>
will send formmated output to the specified e-mail:

yname=karl
ytext=test

<Form action=&quot;mailto:you@some.com?Subject=Welcome&quot; method=&quot;post&quot; enctype=&quot;text/plain&quot;>

will change the default subject &quot;Form posted from <browser>&quot;

D.
 
still thats like clientside validation, not target processing, how can you in javascript or HTML, on the target page, process the passed information, for example if I wanted a big RED caption on the target page with the passed information. Karl Blessing aka kb244{fastHACK}
kblogo.jpg
 
got ur point, (at last! X-))
but do u mean processing on the other page or on the same ?
if on the same then u shuld use layers (innerHTML for ie4+, nn6 & document.layers.layername.document.write('some_Value_From_Some_Form') for nn4x)
if u're talkin about processing it on the other page then i, cant say about post method, but get is do-able (location.search & stuff)
am i on the right way?? regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top