By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,978 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,978 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
==========================================


Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


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

Ray at home

"bart plessers" <ba**********@hotmail.com> wrote in message
news:uZ**************@TK2MSFTNGP11.phx.gbl...
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

Jul 19 '05 #2

P: n/a
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 ... ;)

--
HyperART
Paul Van Ostaijenlaan 4
3001 Heverlee

"Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in message
news:eb*************@TK2MSFTNGP12.phx.gbl...
I think you mean:
<%
If UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" Then
''your code
End If

Ray at home

"bart plessers" <ba**********@hotmail.com> wrote in message
news:uZ**************@TK2MSFTNGP11.phx.gbl...
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


Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.