denam
asked on
vbscript, forms, action
I'm trying to set the action in a form using a select.
I've stolen an example right out of the book, but my
script fails. What am I doing wrong?
I've stolen an example right out of the book, but my
script fails. What am I doing wrong?
ASKER
the option value for the first selection (Argentina) is wrong in the previous comment.
it should just be "Argentina"
it should just be "Argentina"
I don't see any form element named 'sWhereToGo' in the code you posted, which was used in setting the Action in VBScript. This might be the reason for the failure. It might be the name of the SELECT you're using. So, give that name to the SELECT and see.
ASKER
the error i get is:
JavaScript Error: line 68:
submitform is not defined.
and, my apologies, i copied the wrong example into the comment box. It should have
been:
<html>
<head>
<title>TIAETL Membership</title>
<SCRIPT Language = "VBScript">
<! --
Sub submitform()
Dim f
Dim sUrl
set f = Document.frmMain
sUrl = ""/private/membership/" & f.WhereToGo.Value & "/default.asp""
f.Method = "Post"
f.Action = sUrl
f.submit
end sub
-->
</script>
<!--#include file="/private/includes/he ader1.txt" -->
<blockquote>
<p><font color="#408080"><strong><b ig>Member' s Area</big></strong></font> </p>
<form name="frmMain">
<select name="WhereToGo">
<option value="Argentina">Argentin a</option>
<option value="Austrailia">Austral ia</option >
<option value="Austria">Austria</o ption>
<option value="Barbados">Barbados< /option>
<option value="Belgium">Belgium</o ption>
<option value="Bermuda">Bermuda</o ption>
<option value="Canada">Canada</opt ion>
<option value="Cayman Islands">Cayman Islands</option>
<option value="Channel Islands">Channel Islands</option>
<option value="Chile">Chile</optio n>
<option value="Denmark">Denmark</o ption>
<option value="England">England</o ption>
<option value="Hong Kong">Hong Kong</option>
<option value="Italy">Italy</optio n>
<option value="Japan">Japan</optio n>
<option value="Liechtenstein">Liec htenstein< /option>
<option value="Mexico">Mexico</opt ion>
<option value="Monaco">Monaco</opt ion>
<option value="Scotland">Scotland< /option>
<option value="South Africa">South Africa</option>
<option value="Sweden">Sweden</opt ion>
<option value="Switzerland">Switze rland</opt ion>
<option value="The Netherlands">The Netherlands</option>
<option value="U.S.A.">U.S.A.</opt ion>
</select><input type=Button OnClick=submitform value="Go"></p>
</form>
</blockquote>
<!--#include file="/private/includes/fo oter1.txt" -->
</body>
</html>
JavaScript Error: line 68:
submitform is not defined.
and, my apologies, i copied the wrong example into the comment box. It should have
been:
<html>
<head>
<title>TIAETL Membership</title>
<SCRIPT Language = "VBScript">
<! --
Sub submitform()
Dim f
Dim sUrl
set f = Document.frmMain
sUrl = ""/private/membership/"
f.Method = "Post"
f.Action = sUrl
f.submit
end sub
-->
</script>
<!--#include file="/private/includes/he
<blockquote>
<p><font color="#408080"><strong><b
<form name="frmMain">
<select name="WhereToGo">
<option value="Argentina">Argentin
<option value="Austrailia">Austral
<option value="Austria">Austria</o
<option value="Barbados">Barbados<
<option value="Belgium">Belgium</o
<option value="Bermuda">Bermuda</o
<option value="Canada">Canada</opt
<option value="Cayman Islands">Cayman Islands</option>
<option value="Channel Islands">Channel Islands</option>
<option value="Chile">Chile</optio
<option value="Denmark">Denmark</o
<option value="England">England</o
<option value="Hong Kong">Hong Kong</option>
<option value="Italy">Italy</optio
<option value="Japan">Japan</optio
<option value="Liechtenstein">Liec
<option value="Mexico">Mexico</opt
<option value="Monaco">Monaco</opt
<option value="Scotland">Scotland<
<option value="South Africa">South Africa</option>
<option value="Sweden">Sweden</opt
<option value="Switzerland">Switze
<option value="The Netherlands">The Netherlands</option>
<option value="U.S.A.">U.S.A.</opt
</select><input type=Button OnClick=submitform value="Go"></p>
</form>
</blockquote>
<!--#include file="/private/includes/fo
</body>
</html>
ASKER
btw, the form is saved with a .htm extension.
Which browser you're using to test this page?
Which browser you're using to test this page?
ASKER
btw, the form is saved with a .htm extension.
ASKER
i'm Netscape navigator 4.05
No problem, .htm extension is not the reson for your problem
ASKER
i'm Netscape navigator 4.05
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks rajgn.
ASKER
is there any good online reference that can show me how to do this in javascript?
thx.
thx.
Just hold on for a sec. I'll be back to you...
ASKER
is there any good online reference that can show me how to do this in javascript?
thx.
thx.
Have a look at:
http://developer.netscape.com/tech/javascript/resources.html
for various JavaScript resources. Hope you like it. Here I'm writing the same function in JavaScript, for you. Try it out. If you've any probs. can get back to me.
<SCRIPT Language = "JavaScript">
function submitform() {
var sUrl
sUrl = ""/private/membership/" + sWhereToGo.Value + "/default.asp""
Document.frmMain.Method = "Post"
Document.frmMain.Action = sUrl
Document.frmMain.submit()
}
</script>
make a change in button's code as follows:
onClick="submitform()"
http://developer.netscape.com/tech/javascript/resources.html
for various JavaScript resources. Hope you like it. Here I'm writing the same function in JavaScript, for you. Try it out. If you've any probs. can get back to me.
<SCRIPT Language = "JavaScript">
function submitform() {
var sUrl
sUrl = ""/private/membership/"
Document.frmMain.Method = "Post"
Document.frmMain.Action = sUrl
Document.frmMain.submit()
}
</script>
make a change in button's code as follows:
onClick="submitform()"
ASKER
is there any good online reference that can show me how to do this in javascript?
thx.
thx.
ASKER
wow, thanks. that's really above and beyond!
You're welcome...
ASKER
under a directory for that country.
==========================
<html>
<head>
<title></title>
<SCRIPT Language = "VBScript">
<! --
Sub submitform()
Dim f
Dim sUrl
set f = Document.frmMain
sUrl = ""/private/membership/"
f.Method = "Post"
f.Action = sUrl
f.submit
end sub
-->
</script>
<!--#include file="/private/includes/he
<blockquote>
<p><font color="#408080"><strong><b
<form name="frmMain">
<select>
<option value="membersarea/default
<option value="Austrailia">Austral
<option value="Austria">Austria</o
<option value="Barbados">Barbados<
<option value="Belgium">Belgium</o
<option value="Bermuda">Bermuda</o
<option value="Canada">Canada</opt
<option value="Cayman Islands">Cayman Islands</option>
<option value="Channel Islands">Channel Islands</option>
<option value="Chile">Chile</optio
<option value="Denmark">Denmark</o
<option value="England">England</o
<option value="Hong Kong">Hong Kong</option>
<option value="Italy">Italy</optio
<option value="Japan">Japan</optio
<option value="Liechtenstein">Liec
<option value="Mexico">Mexico</opt
<option value="Monaco">Monaco</opt
<option value="Scotland">Scotland<
<option value="South Africa">South Africa</option>
<option value="Sweden">Sweden</opt
<option value="Switzerland">Switze
<option value="The Netherlands">The Netherlands</option>
<option value="U.S.A.">U.S.A.</opt
</select><input type=Button OnClick=submitform value="Go"></p>
</form>
</blockquote>
<!--#include file="/private/includes/fo
</body>
</html>