Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using date picker gives an error message, only at application start

Status
Not open for further replies.

leifoet

Technical User
Jan 31, 2016
206
BE
Only at startup, and before pressing the submit button, the code below gives the following error:

> Microsoft VBScript runtime error '800a000d'
> Mismatch type: 'cdate'
(refers to the 'cdate' on the last section of code below)

After the first press on the submit button, the requested table (from 01/01/2021) appears on the screen without hitches (and also a new table after changing the date in the date picker and a press on the submit button).
(request.form via METHOD="POST")

Question : (how) can I avoid that initial error message (at the start) ?
Thanks for tips.

Code:
<input type="date" name="datA" placeholder="DD/MM/YYYY" value="2021-01-01">

<tr>
<td><input type="submit" name="Submit" value="Submit">
</td></tr>

<%
		CurrentDay = right(request.form("datA"),2)
		CurrentMonth = mid(request.form("datA"),6,2)
		CurrentYear = left(request.form("datA"),4)
%>		

<%
Dim Conn, rs, sql
Set Conn ...
...
rs.Open sql, Conn
%>

<%
Do While rs("Dat")>=[b]cdate[/b](CurrentDay&"/"&CurrentMonth&"/"&CurrentYear)
... (table)
rs.MoveNext
loop
%>
 


The input box does not exist in the Request.Form on the initial GET because it is part of the Response (not the Request) as the client has just arrived at the page and the server is delivering the content. It will only exist in the Request.Form after a POST request by the client. You'll need to determine if the "datA" exists in the Request.Form before parsing the date itself.

Code:
CurrentDay = right([highlight #FCE94F]request.form("datA")[/highlight],2)

Code:
<%
[indent]if Request.Form("datA") then [/indent]
[indent]...[/indent]
[indent]End IF[/indent]
%>


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top