how to determine is a FORM has displayed for first time?

B

bart plessers

Hello,

I have a form with some checkboxes, i.e.

The default value of this checkbox is determined in a global file
(config.asp), that is included in first line of the form, i.e.
ShowFilenames = 1


The first time the form is displayed, the value of ShowFilenames should be
the one defined in config.asp.
As result of the form, the value should be modified according to users input

I achieved this by checking the contents :
ShowFilenames = Len(Request.Form("ShowFilenames"))>0

However,
The first time the form is showed, no data is passed yet to the form,
so Request.Form("ShowFilenames") is empty
and ShowFilenames becomes False


How can I make that in this case ShowFileNames becomes the value defined in
the included file?

The whole section of Request.Form should only be executed IF the form has
already been executed.
So Is there a way to determine this?



tia

bartp



As an example, here is my form
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<!--#include file="_settings.asp" -->
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%
If Len(Request.Form("Rows"))>0 Then Rows = CInt(Request.Form("Rows")) end if
If Len(Request.Form("Columns"))>0 Then Columns =
CInt(Request.Form("Columns")) end if
ShowFilenames = Len(Request.Form("ShowFilenames"))>0
%>

<body>
<p>FORM</p>
<FORM NAME="frmFileViewer" ACTION="" METHOD="post">
<TABLE border="0" align="center" cellpadding="0" cellspacing="0"
bgcolor="#CCCCCC">
<tr>
<td width="100">Columns</td>
<td><input type='text' name='Columns' value='<%=Columns%>'
size='4'></td>
</tr>
<tr>
<td>Rows</td>
<td> <input type='text' name='Rows' value='<%=Rows%>' size='4'></td>
<tr>
<td>ShowFileName</td>
<td> <input type="checkbox" name="ShowFilenames" value="1" <%if
ShowFilenames Then %>checked<%end if%>></td>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Submit" name="ButtonSubmit"></td>
</tr>
</TABLE>
</FORM>
<p>FORM RESULTS</p>
<TABLE border="0" align="center" cellpadding="0" cellspacing="0"
bgcolor="#CCCCCC">
<tr>
<td width="100">Columns</td>
<td><%=Columns%></td>
</tr>
<tr>
<td>Rows</td>
<td>
<%=Rows%>
</td>
<tr>
<td>ShowFileNames</td>
<td>
<%=ShowFileNames%>
</td>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</TABLE>
<p>&nbsp;</p>
</body>
</html>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


and the included file
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%
Columns=3
Rows = 2
ShowFileName = True
%>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




--

==========================================
Hyper A.R.T.
bart plessers
Paul Van Ostaijenlaan 4
3001 Heverlee
BELGIUM
tel: +32 (16) 23.40.85
fax: +32 (16) 23.41.06
==========================================
 
R

Ray at

I think you mean:
<%
If UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" Then
''your code
End If

Ray at home
 
B

Bart Plessers \(artabel\)

Ray,

sometimes it is hard to run if you don't know how to walk...
Exactly what I needed again!

thanx
regards,
bartp

ps
I hope I don't give you to much work those days ... ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top