Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook 2000 Form & VB/VBScript 1

Status
Not open for further replies.

jedthecat

Programmer
Apr 10, 2001
2
US

I have a form that needs a little VBScript tweeking, I think.

I have an Option button with a properties label of "OtherOption". Next to it on the form I have created a text box with the properties label of "OtherInfo".

There are several other Option buttons on the form.

What I want to be able to do is to have the "OtherInfo" text box be enabled only when the "OtherOption" option button has been clicked, otherwise the text box should be disabled if any other Option button is selected.

If someone can guide me to a reference place where I can learn how to do this trick, or can help out, I'd be greatly appreciative.

I have set the default of the OtherInfo (the text box)to disable and I tried using coding like this:

Private Sub OptionOther_onClick()
OtherInfo.Enabled = -1 ****where -1 = True
End Sub

when running the form, the text box does not enable when I click on the OptionOther radio (option) button.

Thanks.



 
If you're not opposed to using a little javascript, instead of vbscript, here's something that does more or less the same thing --

The names and what is clicked is different, but the idea is the same:

<html>
<head>
<title>test</title>
<script language=javascript>

function checkIt(){
if (document.thisForm.c1.checked == true || document.thisForm.c2.checked == true)
document.thisForm.c3.disabled = false;
else
document.thisForm.c3.disabled = true;
}

</script>
</head>
<body onLoad=&quot;document.thisForm.c3.disabled = true;&quot;>
<form name=thisForm action=&quot;somepage.asp&quot; method=post>
<input type=checkbox name=c1 onClick=&quot;checkIt();&quot;>
<input type=checkbox name=c2 onClick=&quot;checkIt();&quot;>
<input type=textbox name=c3>
<input type=submit name=submit value=submit>
<input type=reset name=reset value=reset onClick=&quot;document.thisForm.c3.disabled = true;&quot;>
</form>
</body>
</html>

Where the text box is disabled as soon as the page loads, and does not become enabled until one of the checkboxes has been turned on --

hitting 'reset' will disable the box again --

If this isn't clear, post back, with your code, and we'll work it out.


good luck! :)
Paul Prewett
 
The reading that I have done with regards to writing a script for Microsoft Outlook only mentions being able to use Visual Basic, VB Script, Visual Interdev and some other seemingly MS based software.

If you know that javascript is a supported scripting language within Outlook, then I could try the script that you wrote.

Thanks for the reply as I'm sure that I can still put it to good use if not on this mission.

Cordell
 
Just a little modification got it working in vbscript:
Code:
<html>
<head>
<title>test</title>
<script language=vbscript>

function checkIt()
    if ((document.thisForm.c1.checked = true) or (document.thisForm.c2.checked = true)) then
        document.thisForm.c3.disabled = false
    else
        document.thisForm.c3.disabled = true
    end if
end function

function resetIt()
	document.thisForm.c3.disabled = true
end function

</script>
</head>
<body onLoad=&quot;resetIt()&quot;>
<form name=thisForm action=&quot;somepage.asp&quot; method=post>
    <input type=checkbox name=c1 onClick=&quot;checkIt()&quot;>
    <input type=checkbox name=c2 onClick=&quot;checkIt()&quot;>
    <input type=textbox name=c3>
    <input type=submit name=submit value=submit>
    <input type=reset name=reset value=reset onClick=&quot;resetIt()&quot;>
</form>
</body>
</html>

:)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top