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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alert when box not checked

Status
Not open for further replies.

Peanut13

Programmer
Feb 1, 2001
3
US
Help,

I am trying to add code to .asp page that will alert the user that they must check a box confirming they understand the rules associated with an upload to that page. Can someone help me with this? Upon "submit" if the box is not checked an alert message would pop up.

here is the code:


<%
' Upload include file

%>

<!-- BEGIN upload/upload -->


<% If Request(&quot;uplPath&quot;) = &quot;&quot; Then %>
<p>Sorry, you can not view this page because you haven't
reached this page from a proper fileview page.<p>
<p>In order to be able to upload files, please visit the
proper fileview page and click on the &quot;Upload File&quot; button.</p>
<% Else

Dim myUplPath
myUplPath = Request(&quot;uplPath&quot;)

%>

<p><b>Before you upload...</b></p>
<ul>
<li>Make sure the &quot;Title&quot; and &quot;Author&quot; properties of your
file are filled out.</li>
<li>Check the Overwrite box only to overwrite YOUR files.
<b>DO NOT</B> try to overwrite files some one else owns.</li>
<li>Depending on the server demands, you may encounter a
brief elapse before you see the upload results.</li>
<li><b><font color=red>WARNING:</font></b>Disclaimer goes here
<a href=&quot;/&quot;>Control policy</a></li>
</ul>

<p>Your file will be uploaded to
<b><%= myUplPath %></b></p>



<script language=&quot;javascript&quot; type=&quot;text/javascript&quot;>
<!--
function ConfirmBox()
{
var value;
if (document.UploadForm.Overwrite.checked = true)
{
if (confirm(&quot;Warning: This will overwrite the file on the &quot; +
&quot;server with the existing file. Are you sure you want to &quot; +
&quot;do this?&quot;))
{
value = 1;
}
else
{
document.UploadForm.Overwrite.checked = false;
value = 0;
}

return value;
}
}

//-->
</script>

<form method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;
action=&quot;/global/tools/upload/response.asp&quot; name=&quot;UploadForm&quot;>
<input type=&quot;file&quot; name=&quot;file1&quot;>
<input type=&quot;checkbox&quot; name=&quot;Overwrite&quot; value=&quot;Yes&quot;
onclick=&quot;ConfirmBox();&quot;>Overwrite
<br>
<input type=&quot;checkbox&quot; name=&quot;controlled&quot; value=&quot;Yes&quot;
onclick=&quot;Controlbox();&quot;>
Confirm
<table border=&quot;0&quot; width=&quot;70%&quot; summary=&quot;[layout]&quot;>
<tbody>
<tr>
<td>
<input type=&quot;submit&quot; name=&quot;Upload&quot; value=&quot;Upload&quot;
class=&quot;formbutton&quot; style=&quot;font-size: 7pt&quot;>
</td>
<td>
<input type=&quot;button&quot; name=&quot;Cancel&quot; value=&quot;Cancel&quot;
class=&quot;formbutton&quot; style=&quot;font-size: 7pt&quot;
onclick=&quot;history.back()&quot;>
</td>
</tr>
</tbody>
</table>

<input type=&quot;hidden&quot; name=&quot;RedirectTo&quot;
value=&quot;<%= Request.ServerVariables(&quot;HTTP_REFERER&quot;) %>&quot;>
<input type=&quot;hidden&quot; name=&quot;RedirectFolder&quot;
value=&quot;<%= Request.Form(&quot;RedirectFolder&quot;) %>&quot;>
<input type=&quot;hidden&quot; name=&quot;uplPath&quot;
value=&quot;<%= myUplPath %>&quot;>
</form>
<% End If %>

<!-- END upload/upload -->
 
Hi.

An exapmple from(this page is recommended):

<HEAD>
<SCRIPT>
function checkthis()
{
if (oCheckbox.checked == true)
{
alert(&quot;It's got a check; now off to Microsoft!&quot;);
window.open(&quot; }
}
</SCRIPT>
</HEAD>
<BODY>
Check here if you wish to go to Microsoft:
<INPUT ID=oCheckbox TYPE=checkbox onclick=checkthis()>
</BODY>


regards, Kirilla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top