Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Checkbox condition

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,63711
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Checkbox condition
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Checkbox condition - 8/21/2008 11:13:52 PM   
  roopak.prajapat

 

Posts: 8
Score: 0
Joined: 8/21/2008
Status: offline
Hi All,

I have a few checkboxes in my vbscript. They are names checkbox1, checkbox2, checkbox3.........etc.

I have a function which verifies checkbox status in loop.

Function checkboxcheck

for i=1 to 10
if ("checkbox" & i).checked then
msgbox "wow"
end if
Next
End Fuction

I always receive an saying Error: Object Required: '[string "checkbox1"]'
Could you plz let me know as where am i going wrong and how can i correct it.

Thanks

Roopak
 
 
Post #: 1
 
 RE: Checkbox condition - 8/22/2008 3:49:04 AM   
  Rischip


Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
checkboxElement = "checkbox"&i
Set myChkBox = document.getelementbyid(checkboxElement)

_____________________________

Rischip
Author of - The Grim Linker

(in reply to roopak.prajapat)
 
 
Post #: 2
 
 RE: Checkbox condition - 8/25/2008 2:51:08 AM   
  roopak.prajapat

 

Posts: 8
Score: 0
Joined: 8/21/2008
Status: offline
Thanks Rischip,

it works but i get an error after the result. it says object required: mychkbox
could you plz suggest what the reason could be.

Regards,

Roopak

(in reply to Rischip)
 
 
Post #: 3
 
 RE: Checkbox condition - 8/25/2008 2:56:50 AM   
  Rischip


Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
Well you have for i= 1 to 10

Do you have 10 checkboxes?

If not you need to check the validity of the myChkBox object to verify it is in fact an object.

_____________________________

Rischip
Author of - The Grim Linker

(in reply to roopak.prajapat)
 
 
Post #: 4
 
 RE: Checkbox condition - 8/25/2008 8:17:37 PM   
  roopak.prajapat

 

Posts: 8
Score: 0
Joined: 8/21/2008
Status: offline
Hi Rischip,

Thanks for your reply. I found the mistake. everything works fine now.

Thanks again.

Roopak

(in reply to Rischip)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Checkbox condition Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts