Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript 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
  #1 (permalink)  
Old April 24th, 2007, 01:24 AM
Registered User
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Radio button problem

hello , i'm doing a survey in asp which is connected to ms sql server , i've tested my code and its working , i'm trying to show warnning msg to the user , when ever the user forgets to vote for any service for example reservation , and byt the reservation has 3 values .But my code is not working in the way i wanted to, it gives me a warnning msg even though if i select one of the values! , can any one help me out


sub validat()

Dim v
  For n = v to Document.frm.reservation.length - 1
    If not Document.frm.reservation(v).checked Then
   msgbox "Please vote the reservation"
  exit for
  end if
if document.frm.reservation(v).checked then

 end if
  exit for

end sub

<form name="frm" method=post action="vote.asp">

<input type="radio" name="reservation" value="bad">bad
<input type="radio" name="reservation" value="good">good
<input type="radio" name="reservation" value="Excellent">Excellent

<input type="submit" value="submit" onclick="validat">

Reply With Quote
  #2 (permalink)  
Old May 21st, 2007, 02:08 PM
Registered User
Join Date: May 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

'If not Document.frm.reservation(v).checked Then'

...should be...

'If not Document.frm.reservation(n).checked Then'


'if document.frm.reservation(v).checked then'

...should be...

'if document.frm.reservation(n).checked then'
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Radio button Jolley_tolson Javascript 2 July 15th, 2007 05:50 AM
VBExpress 2005 : Radio Button Problem mague Visual Basic 2005 Basics 0 July 4th, 2007 02:13 AM
Radio button problem rkid BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 April 24th, 2007 12:42 AM
Button acts depending on radio button values janise Access 4 March 10th, 2004 12:53 AM

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