473,669 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Doesn't Work Properly

Hi,

I'm new to ASP and can't get this form to work. It's a simple page
that draws a calendar for the current month and then you can select a
new month and it draws the new calendar. It works fine the first time
I load the page but doesn't work when I submit the form. It doesn't
seem to be properly evaluating the first if statement for drawing the
calendar but all the variables seem to be correct (i.e. it it using
the values passed from the form). Any suggestions? It's running on
Windows 2000. The code is below. Thanks in advance.

Mike
<%@ Language=VBScri pt %>
<% Option Explicit %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<title>Calendar </title>
</head>

<body topmargin="0" leftmargin="0" bgcolor="#FFFFF F" text="#000000"
marginwidth="0" marginheight="0 ">

<%

'declare variables
Dim currentYear, firstDay, currentDate, currentMonth, i, y, start,
finish

if (Request.form(" themonth")) then
currentMonth = Request.form("t hemonth")
else
currentMonth = Month(Date)
end if
if (Request.form(" theyear")) then
currentYear = Request.form("t heyear")
else
currentYear = Year(Date)
end if

currentDate = DateSerial(curr entYear, currentMonth, 1)
firstDay = Weekday(current Date)
%>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<form action="calenda r.asp" method="POST">
<tr>
<td colspan="7" align="center">
<select name="themonth" >
<option value="1" <% if (currentMonth = 1) then Response.write "
selected" %>>January</option>
<option value="2" <% if (currentMonth = 2) then Response.write "
selected" %>>February</option>
<option value="3" <% if (currentMonth = 3) then Response.write "
selected" %>>March</option>
<option value="4" <% if (currentMonth = 4) then Response.write "
selected" %>>April</option>
<option value="5" <% if (currentMonth = 5) then Response.write "
selected" %>>May</option>
<option value="6" <% if (currentMonth = 6) then Response.write "
selected" %>>June</option>
<option value="7" <% if (currentMonth = 7) then Response.write "
selected" %>>July</option>
<option value="8" <% if (currentMonth = 8) then Response.write "
selected" %>>August</option>
<option value="9" <% if (currentMonth = 9) then Response.write "
selected" %>>September</option>
<option value="10" <% if (currentMonth = 10) then Response.write "
selected" %>>October</option>
<option value="11" <% if (currentMonth = 11) then Response.write "
selected" %>>November</option>
<option value="12" <% if (currentMonth = 12) then Response.write "
selected" %>>December</option>
</select>
<select name="theyear">
<%
start = currentYear - 1
finish = currentYear + 3
for y=start to finish
Response.write "<option value=""" & y & """"
if (y = currentYear) then Response.write " selected"
Response.write ">" & y & "</option>"
next
%>
</select>
<input type="submit" name="submit" value="Go">
</td>
</tr>
</form>
<tr>
<td>Sunday</td>
<td>Monday</td>
<td>Tuesday</td>
<td>Wedenesda y</td>
<td>Thursday</td>
<td>Friday</td>
<td>Saturday</td>
</tr>
<tr>
<%

'draw calendar

For i=1 to 42
Response.Write "<td>"
if(Month(curren tDate)<>current Month) or (i < firstDay) then
Response.write "&nbsp;"
else
Response.write Day(currentDate )
end if
Response.write "</td>"
if (i mod 7)="0" Then
Response.write "</tr>"
end if
if (i >= firstDay) Then
currentDate=dat eAdd("d", 1, currentDate)
end if
Next

%>

</table>
</body>
</html>
Jul 19 '05 #1
1 2249
Mike wrote on 21 dec 2003 in microsoft.publi c.inetserver.as p.general:
if (Request.form(" themonth")) then


A request.form ALWAYS exist, if not entered it is an empty string.

So:

if Request.form("t hemonth") <> "" then

The parentheses are not needed and just add execution overhead.

In fact this is enough:

if Request.form("t hemonth") > "" then

because no string can be smaller, in (V)basic terms, than an empty string.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2

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

Similar topics

5
4597
by: Tyler Style | last post by:
Hullo - looking for a little advice here. I have a form on a page in one domain submitting to a cgi in another domain. Weirdly, on some Windows XP systems, a form on the page fails to submit/post properly to the cgi and users get the message from IE that it "Cannot find server: The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to...
4
4573
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET forum). I don't use server controls in it (apart from Page). The problem occurs on the page where visitor can post a new messages. Basically, it's a form with couple of
27
4728
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
11
2986
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether certain fields match certain criteria, and inform the user in different ways when the data is wrong (offcourse, this will be checked on posting the data again, but that's something I've got a lot of experience with). Now, offcourse it's...
0
2744
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool ProcessCmdKey(ref Message msg, Keys keyData) To map "Keys" objects to their string constant, and stored them on a string Queue as they were happening. Then (after resetting the form), I simulate replaying of these actions by flushing the queued...
3
5634
by: Ralph | last post by:
Hi I have small function to generate my form controls: function buildInput(sType, vValue, vId, sName, sLabel){ var oInput = null; var oLabel = document.createElement('label'); var oCont = document.createElement('span'); var oText = document.createTextNode(sLabel); oInput = document.createElement('<input type="'+ sType +'" name="'+ sName +'" />');
13
7347
by: Edwin Smith | last post by:
I have a form which displays a DataGridView table generated with the VS2005 tools. The database is a Pervasive v.9 with an ODBC driver. The DataGridView works great except when I'm done and I click the X to close the form the .exe refuses to die and has to be killed in Task manager. I ran a debug trace and it seems to work fine. I dropped a CLOSE button onto the form and put "this.Close();" in for it's event but I get the same result.
26
2799
by: Jerim79 | last post by:
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when they press next the form generates "How old are you?" 5 times on the page. The customer will answer all 5 questions then press next. Finally, all the local variables get dynamically created and written to a database. I have already taken care of...
0
8382
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
8893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8586
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7405
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
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
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
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...
1
2792
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
2
1787
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.