Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 VBScript in a .htm file
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Biddyman
Starting Member

32 Posts

Posted - 13 January 2008 :  20:40:31  Show Profile  Visit Biddyman's Homepage  Send Biddyman a Yahoo! Message
I have a checkbox on a form and was wanting to print a yes or no on a page after it. If the box is unchecked, it is empty. Checked = 1.

I thought it would be a simple:

<script type="text/vbscript">
if isempty(checkbox)then
		document.write("No")
	else
		document.write("Yes")
end if
</script>


But I get an error. "wrong number of arguments or invalid property assignment: 'isempty'"

Any suggestions? It worked on the w3schools site. Hahahah!

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 13 January 2008 :  21:00:18  Show Profile
You need to point to the check box, using the hierarchy.
Something like document.formname.checkbox_name

So would be:
if isempty(document.form_name.checkbox_name) then

I think. Where's the w3schools page you saw this working at?

Support Snitz Forums
Go to Top of Page

Biddyman
Starting Member

32 Posts

Posted - 13 January 2008 :  21:14:21  Show Profile  Visit Biddyman's Homepage  Send Biddyman a Yahoo! Message
http://www.w3schools.com/ / _conditionals.asp It gives a anther window to test on if you click one of those first three links.

I, of course, had to add "x=empty" and also with a value to see if the else worked.

Here is something I forgot, If it has a value it goes to 'else' no problem. It will not print the 'No'. I figured isempty would work since the field is empty if it isn't checked.

I just put 'checkbox' for the variable. It actually has a placeholder carrying the data.

Edited by - Biddyman on 13 January 2008 21:16:16
Go to Top of Page

Biddyman
Starting Member

32 Posts

Posted - 13 January 2008 :  21:34:52  Show Profile  Visit Biddyman's Homepage  Send Biddyman a Yahoo! Message
After 4 hours, I figured it out. It was simple:

<script type="text/vbscript">
if "checkbox"= "" then
	document.write("No")
  else
  	document.write("Yes")	
end if
</script>
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 13 January 2008 :  22:02:20  Show Profile  Visit JJenson's Homepage
I have found biddyman that the simple answer usually is staring you right in the face. At least its always the really dumb mistakes for me.
Go to Top of Page

Biddyman
Starting Member

32 Posts

Posted - 13 January 2008 :  22:56:09  Show Profile  Visit Biddyman's Homepage  Send Biddyman a Yahoo! Message
So true, I was bugging you over the favicon and finally posted my code in another topic which was copied from another thread. Turns out the code was wrong on the first topic all along.

I'm not a coder, but I did take (showing my age) 'Basic' back in the early 90s and in high school in the early 80s. One thing I remember my instructors always saying:

1. Always write the shortest code you have to, afterall programmers are lazy and trying to make things easier in the first place.
2. Always flow chart and remark your code. I laugh at this one. The instructor works for State Farm and hates going into code and not seeing remarks when he is updating stuff.
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 14 January 2008 :  00:14:27  Show Profile  Visit JJenson's Homepage
Yeah sorry I forgot to mention that there was a few instances. Just been a bad week jsut now getting a few minutes for something I wanted to do then I got stuck with building a HOA site so I am working on that.

I will try and look a little harder next time for ya
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 14 January 2008 :  05:33:57  Show Profile
If you're running this clientside, you need to use javascript as vbscript is only supported by IE.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

Biddyman
Starting Member

32 Posts

Posted - 14 January 2008 :  06:17:41  Show Profile  Visit Biddyman's Homepage  Send Biddyman a Yahoo! Message
Thanks Shaggy, I hadn't gotten to test it on firefox.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07