Page

F.10.3- Sample Hidden Fields 01 - Simple Example

Created by Brendan Doss.
Last Updated by Brendan Doss.  

PublicCategorized as Appendix F.

Not yet tagged
<< F.10.2- Common ErrorsAppendixF

F.10.4- Sample Hidden 02 - Two Page Questionnaire  >>

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>

...

 

 

Appendixf_image023

 

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:

 

Appendixf_image024

<< F.10.2- Common ErrorsAppendixFF.10.4- Sample Hidden 02 - Two Page Questionnaire >>

Copyright © 2003 by Wiley Publishing, Inc.

Powered by Near-TimeTerms of Services | Privacy Policy | Security Policy |