473,216 Members | 1,285 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,216 software developers and data experts.

How to set default value in request.form?

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.
Jul 19 '05 #1
4 7159
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)
Jul 19 '05 #2
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.


Jul 19 '05 #3
"David C. Holley" <Da**********@netscape.net> wrote in
news:u0*************@TK2MSFTNGP09.phx.gbl:
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
Jul 19 '05 #4
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!
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: dmiller23462 | last post by:
Here is the code, it's not complete of course....I've been inserting lines as I go to pinpoint the issue.....I understand that the error message I'm getting (#185 Missing Default Property) is...
1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
7
by: steve | last post by:
Hi all If I use this code <% If Request.Item("col")="firstcoll" Then Response.Write "Checked"%> in .aspx page for example like that <input type="radio" name="col" value="firstcoll" <% If...
3
by: steve | last post by:
Sorry if I have post this two times. Hi all What I'm trying to achieve is: I have a form with two radio buttons, if a visitors check radio button 2 and click submit in the next page radio...
4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
4
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the...
10
by: Brad Baker | last post by:
I have an asp.net/csharp application that requires a particular variable to work properly. This variable is usually passed via a query string in the URL when the application is first run but under...
9
vikas251074
by: vikas251074 | last post by:
I am not getting date value in spite of my good effort. This code was working in my last office where I work. Now I am trying to work at my home pc. but not getting date value. Any can help me why...
0
vikas251074
by: vikas251074 | last post by:
I am using Oracle 9i and ASP I have empno, empname, designation, category, dob. Category have two option 'S' or 'O' When I enter empno, empname, designation, category and dob and when I...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.