[quoted text, click to view] "Nicola Attico" <nicola.attico@gmail.com> wrote in message
news:1193735747.904916.152630@o80g2000hse.googlegroups.com...
> Hi
>
> I'm trying to buld a select form for a country with a button, and when
> the button is pressed a msgbox is displayed with the name of the
> country
>
> This is the code I'm not able to make it run.. can you give me some
> hint?
>
> Thanks!
>
> Nicola
>
> <html>
> <body>
>
> <select name="country"> <option value="" selected="selected">Select
> Country</option> <option value="United States">United States</option>
> <option value="United Kingdom">United Kingdom</option>
[snip]
You didn't need to post all of the Country options to make your point!
</select>
[quoted text, click to view] >
> <form action="Lancia()">
> <input type="button" value="Submit" onClick="Lancia()">
> </form>
>
>
> <SCRIPT LANGUAGE = "VBScript">
> <%
> Sub Lancia()
> x = Request.Form("country")
> MsgBox(x)
> End Sub
> %>
> </SCRIPT>
>
> </body>
> </html>
You're mixing client-side with server-side....
"MsgBox" won't work in ASP as it would be displayed
on the server for which there is no comsole.
VBScript on the client-side won't work in all browsers.
The "action=" of a form element is a server-side
form handler -- not a subroutine or function.
http://www.w3.org/TR/html4/interact/forms.html The "<select>" statement must appear inside of the form.
What are you really trying to do?
Here's a version that displays the selected country on top of
the the selection list if one was picked before hitting Submit.
<%@ Language="VBScript" %>
<% Option Explicit
Dim strSEL
strSEL = Request.Form("country")
If strSEL <> "" Then Response.Write(strSEL)
%>
<html>
<body>
<form action="" method="post">
<select name="country">
<option value="" selected="selected">Select Country</option>
<option value="United States">United States</option>
<option value="United Kingdom">United Kingdom</option>
<!-- insert other options here -->
</select>
<input type="submit" value="Submit">
</form>
</body>
</html>