Forums
This topic is locked
Passing a Trimmed Value from a FormField
Posted 16 Feb 2008 03:18:41
1
has voted
16 Feb 2008 03:18:41 Denis Nolwen posted:
Hi,I try to pass a value from a form field to a detail page,
I would like to be able to trim the form field content to pass only the 2 first characters in the string.
The form is like this:
Enter ZipCode:
<form action="index.asp?Zip=<%= Request.Form ("Zip"%>" method="Get" enctype="multipart/form-data">
<input type="text" name="Zip" id="Zip" />
<input type="submit" value="Search" />
</form>
All suggestion is appreciated,
Thank you in advance,
Denis.
Edited by - Nolwen on 16 Feb 2008 03:20:01
Replies
Replied 21 Feb 2008 00:43:44
21 Feb 2008 00:43:44 Javier Castro replied:
In case you didn't figured it out already.
I used your form to pass the value of Zip from page 1 to page 2. The trim actually is done on page 2, at the moment of display.
Here is the code I used on page1:
<pre id=code><font face=courier size=2 id=code><form action="page2.asp" method="post">
<input name="Zip" type="text" id="Zip" value=" " />
<input type="submit" value="Search" />
</form> </font id=code></pre id=code>
On Page2 I used:
<pre id=code><font face=courier size=2 id=code>
<% Dim Zip
Zip = Request.Form("Zip"
Response.Write Left(Zip, Len(Zip) -3)
%>
</font id=code></pre id=code>
As you can see I'm trimming 3 characters with the (-3)
Also, you use for the Method of GET you use:
Request.QueryString("whateverString"
For POST you use:
Request.Form("whateverString"
hope it helps.
Javier
"I'm a slow learner and I forget fast" grandpa
DW | FW | ASP | HTML | CSS
I used your form to pass the value of Zip from page 1 to page 2. The trim actually is done on page 2, at the moment of display.
Here is the code I used on page1:
<pre id=code><font face=courier size=2 id=code><form action="page2.asp" method="post">
<input name="Zip" type="text" id="Zip" value=" " />
<input type="submit" value="Search" />
</form> </font id=code></pre id=code>
On Page2 I used:
<pre id=code><font face=courier size=2 id=code>
<% Dim Zip
Zip = Request.Form("Zip"
Response.Write Left(Zip, Len(Zip) -3)
%>
</font id=code></pre id=code>
As you can see I'm trimming 3 characters with the (-3)
Also, you use for the Method of GET you use:
Request.QueryString("whateverString"
For POST you use:
Request.Form("whateverString"
hope it helps.
Javier
"I'm a slow learner and I forget fast" grandpa
DW | FW | ASP | HTML | CSS