Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Simple problem

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Simple problem
  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 >>
 Simple problem - 6/11/2007 7:39:46 PM   
  phil999

 

Posts: 38
Score: 0
Joined: 5/4/2007
Status: offline
Hi I am struglling with a simple HTA problem.  


1. I have a variable "site" which works out where in the world you are on our network via IP and displays a name of the site.  What i would like to do is that only certain checkboxes dipalyed ie if you were from US then only checkbox1 and checkbox3 were visable in the HTA but if you were from UK then all 3 would be visable.

My checkboxes are in a sub testsub

Thanks in advance

Phil

< Message edited by phil999 -- 6/11/2007 7:48:20 PM >
 
 
Post #: 1
 
 RE: Simple problem - 6/11/2007 8:25:04 PM   
  ginolard


Posts: 1053
Score: 21
Joined: 8/10/2005
Status: offline
Use Select Case to determine which checkboxes to hide

E.g

Select Case site
   Case "UK"
      checkbox1.Style.Visibility="Hidden"
   Case "US"
       checkbox2.Style.Visibility="Hidden"
.
.
.
.

End Select

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to phil999)
 
 
Post #: 2
 
 RE: Simple problem - 6/12/2007 7:51:18 AM   
  phil999

 

Posts: 38
Score: 0
Joined: 5/4/2007
Status: offline
I am struggling with this.

So this is where i take case london

      

the london sub contains


      

The checkbox1 is setup

      

The html is

<input type="checkbox" name="Checkbox1"> Change IE Homepage to intraweb
<input id=runbutton  class="button" type="button" value="Run" name="run_button" onClick="TestSub">

I am getting error on this line  Checkbox1.style.visibility="Hidden" and that is if i dim checkbox1 if i dont declare checkbox1 i get an undfinded error.

Any comments appreicated.

Phil


ps i should add this is in an hta 

< Message edited by phil999 -- 6/12/2007 8:07:23 AM >

(in reply to ginolard)
 
 
Post #: 3
 
 RE: Simple problem - 6/12/2007 8:22:36 AM   
  Fredledingue


Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
CheckBox1.disabled = "True"

or

document.all.CheckBox1.  etc

===> would be nice to now what the error is reading...

_____________________________

Fred

(in reply to phil999)
 
 
Post #: 4
 
 RE: Simple problem - 6/12/2007 8:56:35 AM   
  ehvbs

 

Posts: 2196
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi phil999,

As I can't come up with an advise based on the code you posted, I post
this minimalistic/bare bones code, that I would use to tackle your problem:


      

The important part is the use of a DIV as a container for the checkbox and
the use of GetElementById to avoid the hassle with forms and all.

Good luck!

ehvbs

(in reply to Fredledingue)
 
 
Post #: 5
 
 RE: Simple problem - 6/12/2007 6:34:31 PM   
  phil999

 

Posts: 38
Score: 0
Joined: 5/4/2007
Status: offline
Ehvbs you are my hero ;) 

It works perfectly except i am not sure how i would change it for mulitple cases. 

would i add an if statement like this

      

but then how would i defind the different div statements.  Below is my current div statement i am now looking to add an additional one for the us.


      

(in reply to ehvbs)
 
 
Post #: 6
 
 RE: Simple problem - 6/13/2007 3:46:03 AM   
  ehvbs

 

Posts: 2196
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi  phil999,

perhaps this will help you:


      

Good luck!

ehvbs

(in reply to phil999)
 
 
Post #: 7
 
 RE: Simple problem - 6/15/2007 8:22:45 AM   
  phil999

 

Posts: 38
Score: 0
Joined: 5/4/2007
Status: offline
The code is great but i am having problems when trying to change it.

I have the following sub with all the checkboxes in


      

Then i have the following code to select what is hidden


      

The i have following


      

So i know the checkboxes work fine on there own so that leaves the problem either with the fromwhere part or the div sections.  The error i am getting is the object does not support this property of method checkbox1.checked



Any assistance is greatfully appreicated i feel i am so close to completing this its just the last hurdle to over come.


I should add the filtering works fine the problem is the checkboxes do not run. 

Phil

< Message edited by phil999 -- 6/15/2007 8:25:19 AM >

(in reply to ehvbs)
 
 
Post #: 8
 
 RE: Simple problem - 6/15/2007 8:49:43 AM   
  Rischip


Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
You have more than one checkbox with the same name. They all need to be unique.

_____________________________

Rischip
Author of - The Grim Linker

(in reply to phil999)
 
 
Post #: 9
 
 RE: Simple problem - 6/15/2007 8:57:30 AM   
  phil999

 

Posts: 38
Score: 0
Joined: 5/4/2007
Status: offline
even if i just have


       i still get the same error unless i am looking in the wrong place.

(in reply to Rischip)
 
 
Post #: 10
 
 RE: Simple problem - 6/16/2007 8:32:04 AM   
  ehvbs

 

Posts: 2196
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi phil999,

this .hta will demonstrate some good and some bad ways to access a checkbox
and its state:


      

after testing the script as it is, add

  <input type="CHECKBOX" name="Checkbox1" id="cbx01">Get Me!<br>
  <input type="CHECKBOX" name="Checkbox1" id="cbx02">Get Me!<br>
  <p id="pDisplay">

and run it again; then you will see the validity of Rischip's advice. In my opinion your
first step should be to 'clean up' your script: unique names, no checks for checkboxes
that aren't there (e.g. checkbox15), a little bit more care about names (printers2/3?)
and even proper indentation would help.

I don't understand why you use 3 instances of some checkboxes (e.g.

   <input name="Checkbox1" type="checkbox"> Change IE Homepage<br>

). If all users can ask for this action via a checkbox, then one - allways visible -
instance would be enought. Or am I missing something?

ehvbs

(in reply to phil999)
 
 
Post #: 11
 
 
 
  

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 >> Simple problem 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