Access control value and Open page in VBScript question

M

Mark

Hi,

I'm kinda new at this, so this may be a dumb question.

I have a simple page with drop-down and a button. I loaded the drop-down
with strings, and gave each item a value that is a page name. I want the
user to select an item and click the button, and then, in VBScript, open the
page they selected in a new window.

The HTM/VBScript I have is below. When I click the button, I get the error
message "Error 424" (object required).

1) How do I access the Value of the drop-down (the page to open) when the
button is clicked?
BTW, the file "_private/form_results.txt" never gets written to.

2) How do I open the page in new IE window?

Thanks for any help ....

Mark

<p>Select an article from the drop-down, and then click the <b>Display</b>
button to view that article.</p>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" u-file="_private/form_results.txt"
s-format="TEXT/TSV" s-label-fields="FALSE" b-reverse-chronology="FALSE"
s-builtin-fields -->
<p><select size="1" name="cboArticles">
<option value="MakeTime.htm" selected>Make Time for Down Time</option>
<option value="Sibling Rivalry.htm">Traveling Tip: Sibling
Rivalry</option>
<option value="OnStage.htm">On Stage</option>
<option value="GiftListening.htm">The Gift of Listening</option>
<option value="TimesTell.htm">How Many Times Do I Have To Tell
You??</option>
<option value="LayersIce.htm">Layers of Ice (Vol. 1/ Issue 1,
January-2003)</option>
<option value="ParentingEd4All.htm">Parenting Education is for Everyone
(Vol. 1/ Issue 1, January-2003)</option>
</select><input type="button" value="Display" name="btnDisplay"></p>
</form>

<script language="VBScript">
<!--

Sub btnDisplay_onClick

On Error Resume Next

MsgBox cboArticles.Value

If Err <> 0 then MsgBox "Error " & Err & " occurred:" & vbcrlf & Error

End Sub

-->

</script>
 
M

MD WebsUnlimited.com

Hi Mark,

First, I would not use VBScript but use JavaScript instead. I would
accomplish this task by creating a page for each article. Then in the drop
down add the onchange event handler to open the window.

<select onchange="if (this.selectedIndex > 0) {
window.open(this.form.my_text_field.value = this.options
[this.selectedIndex].value;) }" >


The drop down should look like this:
<select onchange="if (this.selectedIndex > 0) { window.open(this.options
[this.selectedIndex].value) }" >
<option>Select Article</option>
<option value="mypage1.htm">Text Article 1</option>
<option value="mypage2.htm">TextArticle 2</option>
</select>
 
M

Mark

Hi Mike,

Thanks for your tip, but when I select any item from the drop down (other
than "Select Article") I get an "Access is denied" error message.

The HTML of the entire page is below

Mark

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Other Atricles</title>
<meta name="Microsoft Theme" content="poetic 101, default">
<meta name="Microsoft Border" content="tlb, default">
</head>

<body>

<p>Select an article to view from the drop-down below.</p>

<select onchange="if (this.selectedIndex > 0) { window.open(this.options
[this.selectedIndex].value) }" >
<option>Select Article</option>
<option value="MakeTime.htm" selected>Make Time for Down Time</option>
<option value="Sibling Rivalry_TT.htm">Traveling Tip: Sibling
Rivalry</option>
<option value="OnStage.htm">On Stage</option>
<option value="GiftListening.htm">The Gift of Listening</option>
<option value="TimesTell.htm">HOW MANY TIMES DO I HAVE TO TELL
YOU??</option>
<option value="LayersIce.htm">Layers of Ice</option>
<option value="ParentingEd4All.htm">Parenting Education is for
Everyone</option>
</select>

</body>

</html>


MD WebsUnlimited.com said:
Hi Mark,

First, I would not use VBScript but use JavaScript instead. I would
accomplish this task by creating a page for each article. Then in the drop
down add the onchange event handler to open the window.

<select onchange="if (this.selectedIndex > 0) {
window.open(this.form.my_text_field.value = this.options
[this.selectedIndex].value;) }" >


The drop down should look like this:
<select onchange="if (this.selectedIndex > 0) { window.open(this.options
[this.selectedIndex].value) }" >
<option>Select Article</option>
<option value="mypage1.htm">Text Article 1</option>
<option value="mypage2.htm">TextArticle 2</option>
</select>

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
-------------------------------------------------------------------------- --
--------------------
If you think I'm doing a good job, let MS know at (e-mail address removed)

Mark said:
Hi,

I'm kinda new at this, so this may be a dumb question.

I have a simple page with drop-down and a button. I loaded the drop-down
with strings, and gave each item a value that is a page name. I want the
user to select an item and click the button, and then, in VBScript, open the
page they selected in a new window.

The HTM/VBScript I have is below. When I click the button, I get the error
message "Error 424" (object required).

1) How do I access the Value of the drop-down (the page to open) when the
button is clicked?
BTW, the file "_private/form_results.txt" never gets written to.

2) How do I open the page in new IE window?

Thanks for any help ....

Mark

<p>Select an article from the drop-down, and then click the
button to view that article.</p>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" u-file="_private/form_results.txt"
s-format="TEXT/TSV" s-label-fields="FALSE" b-reverse-chronology="FALSE"
s-builtin-fields -->
<p><select size="1" name="cboArticles">
<option value="MakeTime.htm" selected>Make Time for Down Time</option>
<option value="Sibling Rivalry.htm">Traveling Tip: Sibling
Rivalry</option>
<option value="OnStage.htm">On Stage</option>
<option value="GiftListening.htm">The Gift of Listening</option>
<option value="TimesTell.htm">How Many Times Do I Have To Tell
You??</option>
<option value="LayersIce.htm">Layers of Ice (Vol. 1/ Issue 1,
January-2003)</option>
<option value="ParentingEd4All.htm">Parenting Education is for Everyone
(Vol. 1/ Issue 1, January-2003)</option>
</select><input type="button" value="Display" name="btnDisplay"></p>
</form>

<script language="VBScript">
<!--

Sub btnDisplay_onClick

On Error Resume Next

MsgBox cboArticles.Value

If Err <> 0 then MsgBox "Error " & Err & " occurred:" & vbcrlf & Error

End Sub

-->

</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top