www.webdeveloper.com
Results 1 to 5 of 5

Thread: How to display a selected Item in option box in a form thru VBscript

  1. #1
    Join Date
    Sep 2010
    Posts
    3

    How to display a selected Item in option box in a form thru VBscript

    Hello all,

    Im having a program called servicerequest.asp. In that i've a form to list all the zone names we are having, on selection of that i've to listout all the branches which is fall under the selected zone.

    Now i could not call a function in the onChange event of the first listbox.

    here is my code:
    Code:
    <%@ Language = VBScript %>
    <% Response.Buffer = True %>
    
    <html>
    <head>
    <title>Shifts @ DR</title>
    <%
    sub displayvalue()
    dim optval
    optval=CStr(Request.QueryString("zonelist"))
    alert "zone : " &optval
    
    end sub
    %>
    </head>
    <body oncontextmenu ="return false">
    <center>
    <font face="Trebuchet MS" color="#333399" ><b>
    Service Request Form
    </b></font>
    <form name=serviceform method="get" action="serviceresult.asp">
    <font face="Trebuchet MS" color="navy"><b>
    	Select Zone : 
    </b></font>
    	<select name="zonelist" autopostback="true" onchange="displayvalue()">
    	\tab<option id="0" value=" " selected></option>\par
    	\tab<option id = "1" value="BANGALORE">BANGALORE</option>\par
    	\tab<option id = "2" value="BERHAMPUR" >BERHAMPUR</option>\par
    	\tab<option id = "3" value="BHUBANESWAR" >BHUBANESWAR</option>\par
    	\tab<option id = "4" value="CHANDIGARH" >CHANDIGARH</option>\par
    	\tab<option id = "5" value="CHENNAI" >CHENNAI</option>\par
    	\tab<option id = "6" value="NEWDELHI" >NEWDELHI</option>\par
    	\tab<option id = "7" value="ELURU" >ELURU</option>\par
    	\tab<option id = "8" value="GUNTUR" >GUNTUR</option>\par
    	\tab<option id = "9" value="HEAD OFFICE" >HEAD OFFICE</option>\par
    	\tab<option id = "10" value="HYDERABAD-I" >HYDERABAD - I</option>\par
    	\tab<option id = "11" value="HYDERBAD-II" >HYDERABAD - II</option>\par
    	\tab<option id = "12" value="KAKINADA" >KAKINADA</option>\par
    	\tab<option id = "13" value="KARIMNAGAR" >KARIMNAGAR</option>\par
    	\tab<option id = "14" value="KOLKATA" >KOLKATA</option>\par
    	\tab<option id = "15" value="KURNOOL" >KURNOOL</option>\par
    	\tab<option id = "16" value="MAHABOOBNAGAR" >MAHABOOBNAGAR</option>\par
    	\tab<option id = "17" value="MUMBAI" >MUMBAI</option>\par
    	\tab<option id = "18" value="NIZAMABAD" >NIZAMABAD</option>\par
    	\tab<option id = "19" value="ONGOLE" >ONGOLE</option>\par
    	\tab<option id = "20" value="TIRUPATHI" >TIRUPATHI</option>\par
    	\tab<option id = "21" value="VIJAYAWADA" >VIJAYAWADA</option>\par
    	\tab<option id = "22" value="VISAKHAPATNAM">VISAKHAPATNAM</option>\par
    	\tab<option id = "23" value="WARANGAL" >WARANGAL</option>\par
    	</select>
    	<input type="button" value = "show" >
    	</form>
    </body>
    </html>
    can anyone give a solution for me. im hanging in this for past 3 days....

    plzzzzzzzzz

  2. #2
    Join Date
    Jan 2008
    Location
    Florida
    Posts
    1,227
    You need to do that in Javascript

  3. #3
    Join Date
    Sep 2010
    Posts
    3
    Cant i do it in VBScript? If so , what is the reason?

  4. #4
    Join Date
    Jan 2008
    Location
    Florida
    Posts
    1,227
    Because VB is a server-side language and JS is client side. You can't call a VB sub from a page that has already loaded (unless via AJAX).

  5. #5
    Join Date
    Sep 2010
    Posts
    3
    Thank U. Can u help to do it Js of the same?.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles