Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2004, 02:21 PM
Authorized User
 
Join Date: Sep 2004
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default check a checkbox with java script

Good afternoon/evening all.

Here's the deal: I have a list of checkboxes within a form and I need to ensure that one checkbox CANNOT be unchecked.

So, if a user clicks this particular checkbox, I execute a java script function and display a message, "You cannot uncheck this checkbox."

After the message appears on the screen, the checkbox becomes unchecked. I would like my java script to check it back for me, but it doesn't. How can I code java script so that it checks the checkbox?

thanks for your help!

sal

Here's the checkbox:

<INPUT type=checkbox name=chkCSHuser onclick=securityAdminUnchecked(); value=cmain\rotondos checked >Salvatore Rotondo (Admin)

Here's the javascript function:

<script language="JavaScript">
<!--

function securityAdminUnchecked()
    {
    alert ("You cannot uncheck this user.\nUser is an administrator.");

    document.frmWebsiteSecurity.chkCSHuser.checked;

    }

//-->
</SCRIPT>

 
Old November 29th, 2004, 08:55 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

  frmWebsiteSecurity.chkCSHuser.checked=true;


----------
Rajani






Similar Threads
Thread Thread Starter Forum Replies Last Post
Print the row of datagrid with checkbox with check niks_crasher VS.NET 2002/2003 0 September 2nd, 2006 03:45 AM
Enable Radio when check on Checkbox... rupen Javascript How-To 2 June 28th, 2006 04:44 AM
how delete row in datagrid which check checkbox ashish2001mca Forum and Wrox.com Feedback 1 September 18th, 2005 03:43 AM
Java vs Java Script functions joemorrison74 J2EE 0 July 6th, 2005 04:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.