F.10.3- Sample Hidden Fields 01 - Simple Example
Created
by Brendan Doss.
|
| << F.10.2- Common Errors | AppendixF |
Sample Hidden Fields 01 - Simple Example
This example uses hidden fields to determine the length of time a visitor takes to fill in the form. The page Hidden01Form.asp simply asks the user to enter a value:
...
<BODY>
<H3>Hidden 01 Form</H3>
Calculate then type the square root of three<BR>
<FORM ACTION="hidden01Response.asp" METHOD=GET NAME="Form1">
<INPUT TYPE=HIDDEN NAME="TimeSent" VALUE="<%=time()%>">
<INPUT NAME="NameFirst"><BR>
<INPUT TYPE="SUBMIT" VALUE="Submit Query">
</FORM>
</BODY>
...
|
|
Both the value entered and the TimeSent are sent to the response page Hidden01Response.asp:
...
<BODY>
<H3>Hidden 01 Response</H3>
Code demonstrating use of hidden fields<BR>
Objective: determine the length of time<BR>
a visitor takes to fill in the form
<HR>
<%
'Visitor never knows about this
'Response.write lines below are for proof of concept
varTimeSent = (Request.QueryString("TimeSent"))
Response.Write "sent = " & varTimeSent & "<BR>"
varTImeBack = time()
Response.Write "back = " & varTimeBack & "<BR>"
varTimeToFill = cDate(varTimeBack) - cDate(varTimeSent)
Response.Write "Time to Fill in Form = " & DateDiff("s",varTimeSent,varTimeBack) & "
seconds"
'code that uses time measurement
%>
<BR><BR><HR>
Compact Version:<BR>
<%
'Above code can be compacted to:
varTimeFill = DateDiff("s",Request.QueryString("TimeSent"),time())
Response.Write varTimeFill
%>
</BODY>
...
|
And the time difference is estimated:
|
|
| << F.10.2- Common Errors | AppendixF | F.10.4- Sample Hidden 02 - Two Page Questionnaire >> |

RSS


