473,624 Members | 2,564 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("B eginDate") <> "" then
iBeginDate = "01.01.2001 "
end if
....

<input name="BeginDate " type="text" class="form" value="<%=Reque st.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 7212
Ragnar Heil wrote on 22 aug 2004 in
microsoft.publi c.inetserver.as p.general:
If Request.Form("B eginDate") <> "" then
iBeginDate = "01.01.2001 "
end if
...

<input name="BeginDate " type="text" class="form"
value="<%=Reque st.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.Fo rm("BeginDate") )
If BeginDate = "" then
BeginDate = "01.01.2001 "
end if
%>

<input
name="BeginDate "
type="text"
class="textInpu t"
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("beginD ate") = "" the response.write "01.01.2004 "
else
response.write request("beginD ate")
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("B eginDate") <> "" then
iBeginDate = "01.01.2001 "
end if
...

<input name="BeginDate " type="text" class="form" value="<%=Reque st.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**********@n etscape.net> wrote in
news:u0******** *****@TK2MSFTNG P09.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
2955
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 referring to "textfile" but I can't find any information as to what the default property SHOULD be.... By the way, I'm working on an online submission form for our intranet that emails several parties AND THEN appends to a text file for later...
1
8734
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware tblSoftware ------------------- ------------------ ---------------------- PID PName PID* SID* SID SWName --- ----- --- --- --- ------ 1 Thomas 1 1 ...
7
548
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 Request.Item("col")="firstcoll" Then Response.Write "Checked"%>>
3
8745
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 button 2 to be check by default If I use this code
4
4624
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 type="checkbox" name="chk_Complete" value="<%Response.Write l_IsChecked%>"<%if cbool(l_IsChecked) then Response.Write " checked"%>> The code to captures the checkbox value in the asp page that builds the sql string is follows
4
6127
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 extra item just doesn't get added to the DropDownList: ============================================= <script runat="server"> Sub Page_Load(..........) Dim dSet As DataSet Dim sqlConn As SqlConnection
10
2505
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 certain circumstances the query string may not contain the variable. So I need some way of establishing a default value if one isn't set. Is there some way I can set a query string on page_load OR is there some way I can use a global variable...
9
3534
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 this happens. This is my part of code given below. <%@ Language=VBScript%> <%Option Explicit%> <html> <head> <title>SABF</title> <!--#include file="font.css"-->
0
1425
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 press enter key all the data remains on the form but only list value is lost. what should I do ? How can I solve this. <%@ Language=VBScript%>
0
8231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.