Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to set default value in request.form?

Reply
Thread Tools

How to set default value in request.form?

 
 
Ragnar Heil
Guest
Posts: n/a
 
      08-22-2004
I have got a form where I offer a default date (01.01.2004) and visitors
can change it and make queries in the database.
After changing this, the customized date should be displayed in the form
instead of the default one.

If Request.Form("BeginDate") <> "" then
iBeginDate = "01.01.2001"
end if
....

<input name="BeginDate" type="text" class="form" value="<%=Request.Form
("BeginDate")%>

Now the entered date keeps, that's fine, but when at the first visit
there is no default date



best regards
R.
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      08-22-2004
Ragnar Heil wrote on 22 aug 2004 in
microsoft.public.inetserver.asp.general:
> If Request.Form("BeginDate") <> "" then
> iBeginDate = "01.01.2001"
> end if
> ...
>
> <input name="BeginDate" type="text" class="form"
> value="<%=Request.Form ("BeginDate")%>
>
> Now the entered date keeps, that's fine, but when at the first visit
> there is no default date


Try in your thinking to keep serverside and clientside apart.
The server will render a html code ready for the client [=browser].

<%
BeginDate = trim(Request.Form("BeginDate"))
If BeginDate = "" then
BeginDate = "01.01.2001"
end if
%>

<input
name="BeginDate"
type="text"
class="textInput"
value="<%= BeginDate %>"
>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
David C. Holley
Guest
Posts: n/a
 
      08-22-2004
You're looking for something along the lines of

value =
<% if request("beginDate") = "" the response.write "01.01.2004"
else
response.write request("beginDate")
end if%>

Be careful though when using dates since there's such a plethora of
issues with having your visitors enter the dates manually as in ...

What if they enter 01/01/2004?
or January 1, 2004?
or 1 Jan 2004?
What if they enter 4/3/2004 do they mean April 3, 2004 or March 4, 2004?

David H


Ragnar Heil wrote:

> I have got a form where I offer a default date (01.01.2004) and visitors
> can change it and make queries in the database.
> After changing this, the customized date should be displayed in the form
> instead of the default one.
>
> If Request.Form("BeginDate") <> "" then
> iBeginDate = "01.01.2001"
> end if
> ...
>
> <input name="BeginDate" type="text" class="form" value="<%=Request.Form
> ("BeginDate")%>
>
> Now the entered date keeps, that's fine, but when at the first visit
> there is no default date
>
>
>
> best regards
> R.


 
Reply With Quote
 
Ragnar Heil
Guest
Posts: n/a
 
      08-31-2004
"David C. Holley" <> wrote in
news::

> Be careful though when using dates since there's such a plethora of
> issues with having your visitors enter the dates manually as in ...
>
> What if they enter 01/01/2004?
> or January 1, 2004?
> or 1 Jan 2004?
> What if they enter 4/3/2004 do they mean April 3, 2004 or March 4,
> 2004?


I don't see a way that all kind of date-styles can be entered.
So I offer them a default date (01.12.2004) which they can modify. It is
a German website,so they won't enter the date this way: 12.01.2004

After entering values in the form the visitors gets search-results back.
The customized values remain for a little while when I go from Page 1 to
Page 2 and so on. But if I jump a bit, the values are lost. Now I am
using a default date to prevent an error message. Is the only way to
solve this to use session variables?


regards. Ragnar


 
Reply With Quote
 
David Holley
Guest
Posts: n/a
 
      08-31-2004
1) Although you may be building a 'German' site, you can't control who's
going to us or their nationality - even if its for an INTRAnet.
Accepting this and controlling the date format will actualy make for a
stronger, better design.

2) What do you mean by 'if a jump around a bit'? What specific steps
result in the default value being lost?

As a side note, its not neccessary to session variables. Setting a
cookie with the default value should suffice.

David H

www.gatewayorlando.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to set default value in DetailVeiw when Add a record? ad ASP .Net 0 04-29-2005 09:56 PM
Using default a empty dictionary as a default value C Gillespie Python 3 03-22-2005 12:22 PM
How to set a default value? Miguel Dias Moura ASP .Net 2 01-03-2005 08:24 PM
Set cursor in first text box and set button as default SibAndela ASP General 1 09-26-2004 06:31 PM



Advertisments