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 August 7th, 2003, 05:50 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default Form check boxes validation

Hi,

I have a form that has two check boxes in it, that pass a param for a url redirection.

Is there a way that if the first check box is already ticked and the user ticks the second one, that the first becomes unticked and vice versa ?

Code below :

This is the Form Page
<form action="GoUrl.asp" method="post" name="form1"><table width="700" border="0">
  <tr>
    <td width="15">
    <input name="GetURL" type="checkbox" id="GetURL" value="newsmenu.asp"></td>
    <td>Tick this box
      if you wish to amend the NEWS section of the website</td>
  </tr>
  <tr>
    <td><input name="GetURL" type="checkbox" id="GetURL" value="careersmenu.asp"></td>
    <td>Tick this box
      if you wish to amend the CAREERS section of the website</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td height="40" valign="bottom"><input type="submit" name="Submit" value="Send">
      <input type="reset" name="Submit2" value="Reset">
      </td>
  </tr>
</table>
</form>

This is the action page
<%
GetURL = request.form("GetURL")
response.redirect "" & GetURL
%>
__________________
Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]
 
Old August 14th, 2003, 09:41 AM
Registered User
 
Join Date: Aug 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey,

Why don't u change the input type to "radio" from "checkbox". I think that'd work..

Vam
 
Old August 17th, 2003, 06:43 PM
Authorized User
 
Join Date: Jun 2003
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to planeswalk
Default

Hi,

There is a way using Javascript and the checkbox's onClick event, but it would be better for you to use the radio button like what krisvamshi said earlier. Try out this code:

  <form>
    <input type="checkbox" name="first" onClick="document.forms[0].second.checked=false">
    <input type="checkbox" name="second" onClick="document.forms[0].first.checked=false">
  </form>

Cheers!


Marlon Villarama
Support Team
Web Burner Hosting
[email protected]
www.webburner.com
Toll-Free: 877-535-2876
 
Old August 21st, 2003, 03:39 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default

Quote:
quote:Originally posted by krisvamshi
 Hey,

Why don't u change the input type to "radio" from "checkbox". I think that'd work..

Vam
Thanks Vam, it is the client requirement to have check boxes.

Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]
 
Old August 21st, 2003, 03:40 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default

Quote:
quote:Originally posted by planeswalk
 Hi,

There is a way using Javascript and the checkbox's onClick event, but it would be better for you to use the radio button like what krisvamshi said earlier. Try out this code:

<form>
    <input type="checkbox" name="first" onClick="document.forms[0].second.checked=false">
    <input type="checkbox" name="second" onClick="document.forms[0].first.checked=false">
</form>

Cheers!


Marlon Villarama
Support Team
Web Burner Hosting
[email protected]
www.webburner.com
Toll-Free: 877-535-2876
Hi Marlon,
This works a treat, many thanks.
C.

Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
JS to check for form Validation does not work - pl jennypretty Classic ASP Basics 4 December 11th, 2008 11:18 PM
Loop over check boxes sams ASP.NET 1.0 and 1.1 Professional 5 July 17th, 2007 06:26 AM
Check Boxes Allan320 Access VBA 3 June 2nd, 2006 05:45 AM
Check-boxes on input form tmangus Access VBA 4 June 14th, 2005 11:40 AM
Getting value of Dynamic Check boxes kathryne Classic ASP Databases 3 March 19th, 2004 05:44 AM





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