473,503 Members | 5,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help testing conditions of a form--trouble with SELECT elements

3 New Member
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus that are SELECT elements (javascript-- one named arrivalcity and one named returncity). Basically they ask for a departure and return city and another menu appears with options based on that city. I can't seem to get the input from these fields in the vbscript. I'm guessing you have to code it a different way. I can get all the other menu fields, but not these two. Any help will be greatly appreciated. Also, I think I read something that with a select element the return will be both fields together. Is this true.

The form is at the following URL:
http://euroflyvacations.com/us/formcarrental14.asp

The VBscript is the following (I know it's long, but I'll put it here if anybody wants to take a look at it).
Expand|Select|Wrap|Line Numbers
  1. <!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" -->
  2. <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  4. <html>
  5.     <head>
  6.         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  7.         <title>Eurofly Vacations Car Rental Booking Form</title>        
  8.         <link href="/includes/style_home.css" rel="stylesheet" type="text/css">
  9.         <style type="text/css">
  10.             body {background-color: #ffffff;}
  11.             .bodyfont {color: #FF0000; font-family: Arial; font-size: 13px; font-weight: normal}
  12.             .otherfont {color: #000000; font-family: Arial; font-size: 13px; font-weight: bold}
  13.         </style>
  14.     </head>
  15.     <body>
  16. <table width="675"  border="0" cellspacing="0" cellpadding="0">
  17.            <tr valign="top">
  18.              <td width="100"><a href="http://euroflyvacations.com"><img src="img/logo_eurofly.jpg" border="0"></a><br>
  19.            <br></td>
  20.   </tr>
  21.          <tr>
  22.            <td>
  23. <%@LANGUAGE="VBSCRIPT"%>
  24.  
  25. <%
  26.     flag = 0
  27.     errmsg = ""
  28.  
  29.  
  30.  
  31. agencyname = Trim(Request.Form("agencyname"))
  32. iata = Trim(Request.Form("iata"))
  33. address = Trim(Request.Form("address"))
  34. citystatezip = Trim(Request.Form("citystatezip"))
  35. contactname = Trim(Request.Form("contactname"))
  36. phone = Trim(Request.Form("phone"))
  37. fax = Trim(Request.Form("fax"))
  38. email = Trim(Request.Form("email"))
  39.  
  40. passenger1first = Trim(Request.Form("passenger1first"))
  41. passenger1last = Trim(Request.Form("passenger1last"))
  42. passenger2first = Trim(Request.Form("passenger2first"))
  43. passenger2last = Trim(Request.Form("passenger2last"))
  44. passenger3first = Trim(Request.Form("passenger3first"))
  45. passenger3last = Trim(Request.Form("passenger3last"))
  46. passenger4first = Trim(Request.Form("passenger4first"))
  47. passenger4last = Trim(Request.Form("passenger4last"))
  48.  
  49. arrivalcity = Trim(Request.Form("arrivalcity"))
  50. departuredate_Rome = Trim(Request.Form("arrival_select1"))
  51. departuredate_Naples = Trim(Request.Form("arrival_select2"))
  52. departuredate_Palermo = Trim(Request.Form("arrival_select3"))
  53. departuredate_Catania = Trim(Request.Form("arrival_select4"))
  54. departuredate_Other = Trim(Request.Form("arrival_select5"))
  55. returncity = Trim(Request.Form("returncity"))
  56. returndate_Rome = Trim(Request.Form("return7"))
  57. returndate_Naples = Trim(Request.Form("return8"))
  58. returndate_Palermo = Trim(Request.Form("return9"))
  59. returndate_Catania = Trim(Request.Form("return10"))
  60. returndate_Other = Trim(Request.Form("return11"))
  61.  
  62. business = Trim(Request.Form("business"))
  63.  
  64. pickuplocation = Trim(Request.Form("pickuplocation"))
  65. dropofflocation = Trim(Request.Form("dropofflocation"))
  66. cartype = Trim(Request.Form("cartype"))
  67. carupgrade = Trim(Request.Form("carupgrade"))
  68. extension = Trim(Request.Form("extension"))
  69. extras = Trim(Request.Form("extras"))
  70. insurance = Trim(Request.Form("insurance"))
  71.  
  72.     if agencyname = "" then 
  73.         errmsg = errmsg & "<span class=bodyfont> - You must supply the Agency Name</span><br>" 
  74.         flag = flag +1 
  75.     end if
  76.  
  77.     if len(iata) < 8 then 
  78.         errmsg = errmsg & "<span class=bodyfont> - You must supply a valid IATA number</span><br>" 
  79.         flag = flag +1 
  80.     end if
  81.  
  82.     if contactname = "" then 
  83.         errmsg = errmsg & "<span class=bodyfont> - You must supply a valid contact name for your agency</span><br>" 
  84.         flag = flag +1 
  85.     end if
  86.  
  87.     if address = "" then 
  88.         errmsg = errmsg & "<span class=bodyfont> - You must supply a valid address for your agency</span><br>" 
  89.         flag = flag +1 
  90.     end if
  91.  
  92.     if citystatezip = "" then 
  93.         errmsg = errmsg & "<span class=bodyfont> - You must supply a valid City, State and Zip Code for your agency</span><br>" 
  94.         flag = flag +1 
  95.     end if    
  96.  
  97.     if len(phone) < 10 then 
  98.         errmsg = errmsg & "<span class=bodyfont> - You must supply a contact phone number for this request</span><br>" 
  99.         flag = flag +1 
  100.     end if
  101.  
  102.     if email = "" then 
  103.         errmsg = errmsg & "<span class=bodyfont> - You must supply a contact email address for this request</span><br>" 
  104.         flag = flag +1 
  105.     else
  106.         if isValidEmail(email) = "False" then 
  107.             errmsg = errmsg & "<span class=bodyfont> - A proper formatted Email 'name@company.com' </span><br>" 
  108.             flag = flag +1 
  109.         end if
  110.     end if
  111.  
  112.     if passenger1first = "" then 
  113.         errmsg = errmsg & "<span class=bodyfont> - You must supply the first name of Passenger 1</span><br>" 
  114.         flag = flag +1 
  115.     end if
  116.  
  117.     if passenger1last = "" then 
  118.         errmsg = errmsg & "<span class=bodyfont> - You must supply the last name of Passenger 1</span><br>" 
  119.         flag = flag +1 
  120.     end if
  121.  
  122.     if arrivalcity = "" then 
  123.         errmsg = errmsg & "<span class=bodyfont> - You must supply a departure city for this request</span><br>" 
  124.         flag = flag +1 
  125.  
  126.     elseif arrivalcity = "1" and  arrival_select1 = "" then
  127.     errmsg = errmsg & "<span class=bodyfont> - You must supply a departure date for this request</span><br>" 
  128.     flag = flag +1 
  129.  
  130.  
  131.     elseif arrivalcity = "2" and  arrival_select2 = "" then
  132.     errmsg = errmsg & "<span class=bodyfont> - You must supply a departure date for this request</span><br>" 
  133.     flag = flag +1 
  134.  
  135.     elseif arrivalcity = "3" and  arrival_select3 = "" then
  136.     errmsg = errmsg & "<span class=bodyfont> - You must supply a departure date for this request</span><br>" 
  137.     flag = flag +1 
  138.  
  139.  
  140.     elseif arrivalcity = "4" and  arrival_select4 = "" then
  141.     errmsg = errmsg & "<span class=bodyfont> - You must supply a departure date for this request</span><br>" 
  142.     flag = flag +1 
  143.  
  144.     elseif arrivalcity = "5" and  arrival_select5 = "" then
  145.     errmsg = errmsg & "<span class=bodyfont> - You must supply an departure date for this request</span><br>" 
  146.     flag = flag +1 
  147.     end if
  148.  
  149.  
  150.     if returncity = "" then 
  151.         errmsg = errmsg & "<span class=bodyfont> - You must supply a return city for this request</span><br>" 
  152.         flag = flag +1 
  153.  
  154.     elseif returncity = "1" and  return1 = "" then
  155.     errmsg = errmsg & "<span class=bodyfont> - You must supply a return date for this request</span><br>" 
  156.     flag = flag +1 
  157.  
  158.     elseif returncity = "2" and  return2 = "" then
  159.     errmsg = errmsg & "<span class=bodyfont> - You must supply a return date for this request</span><br>" 
  160.     flag = flag +1 
  161.  
  162.     elseif returncity = "3" and  return3 = "" then
  163.     errmsg = errmsg & "<span class=bodyfont> - You must supply a return date for this request</span><br>" 
  164.     flag = flag +1 
  165.  
  166.     elseif returncity = "4" and  return4 = "" then
  167.     errmsg = errmsg & "<span class=bodyfont> - You must supply a return date for this request</span><br>" 
  168.     flag = flag +1 
  169.  
  170.     elseif returncity = "5" and  return5 = "" then
  171.     errmsg = errmsg & "<span class=bodyfont> - You must supply a return date for this request</span><br>" 
  172.     flag = flag +1 
  173.  
  174.     else
  175.     end if
  176.  
  177.     if business = "" then 
  178.         errmsg = errmsg & "<span class=bodyfont> - You must supply a business class choice for this request</span><br>" 
  179.         flag = flag +1 
  180.     end if
  181.  
  182.     if pickuplocation = "" then 
  183.         errmsg = errmsg & "<span class=bodyfont> - You must supply a pickup location for this request</span><br>" 
  184.         flag = flag +1 
  185.     end if
  186.  
  187.     if dropofflocation = "" then 
  188.         errmsg = errmsg & "<span class=bodyfont> - You must supply a dropofflocation choice for this request</span><br>" 
  189.         flag = flag +1 
  190.     end if
  191.  
  192.     if carupgrade = "" then 
  193.         errmsg = errmsg & "<span class=bodyfont> - You must supply a car upgrade choice for this request</span><br>" 
  194.         flag = flag +1 
  195.     end if
  196.  
  197.  
  198.     if cartype = "" and carupgrade = "yes" then 
  199.         errmsg = errmsg & "<span class=bodyfont> - Since you have opted for a car upgrade you must select car type for this request</span><br>" 
  200.         flag = flag +1 
  201.     end if
  202.  
  203.     if cartype = "" and carupgrade = "no" then 
  204.             end if
  205.  
  206.  
  207.     if insurance = "" then 
  208.         errmsg = errmsg & "<span class=bodyfont> - You must supply an insurance choice for this request</span><br>" 
  209.         flag = flag +1 
  210.     end if
  211.  
  212.  
  213. Function isValidEmail(myEmail)
  214.   dim isValidE
  215.   dim regEx
  216.  
  217.   isValidE = True
  218.   set regEx = New RegExp
  219.  
  220.   regEx.IgnoreCase = False
  221.  
  222.   regEx.Pattern = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
  223.   isValidE = regEx.Test(myEmail)
  224.  
  225.   isValidEmail = isValidE
  226. End Function
  227. %>
  228. </td></tr></table>
  229.  
  230.  
  231. <%
  232.     if flag = 0 then
  233. %>
  234. <%
  235.     ' read and append to file
  236.     Dim userip, counter, filename, path, fs, file    
  237.     userip = Request.ServerVariables("REMOTE_ADDR")
  238.     counter = 1 'compensate for 0    
  239.  
  240.     Const ForReading   = 1    
  241.     Const ForAppending = 8
  242.  
  243.     'Map the file name to the physical path on the server.
  244.     filename = "requesttgrome.txt"
  245.     path = Server.MapPath(".") & "\" & filename
  246.  
  247.  
  248. '    response.write(    path)
  249.  
  250.     'Open and read a text file.
  251.     set fs = CreateObject("Scripting.FileSystemObject")    
  252.  
  253. '    set file = fs.OpenTextFile(path, ForReading)
  254. '    While not file.AtEndOfStream
  255. '        file.Readline
  256. '        counter = counter + 1
  257. '    Wend
  258. '    file.Close()
  259.  
  260.  
  261.     'Append to an existing text file.
  262. '    set file = fs.OpenTextFile(path, ForAppending)
  263. '    'AgencyName    IATA    Address    CityStateZip    ContactName    Phone    Fax    Email    Passenger1First    Passenger1Last    Passenger1DOB    Passenger2First    Passenger2Last    Passenger2DOB    Passenger3First    Passenger3Last    Passenger3DOB    Passenger4First    Passenger4Last    Passenger4DOB    UserIP    Date/Time
  264. '    file.WriteLine(agencyname &chr(9)& iata &chr(9)& address &chr(9)& citystatezip &chr(9)& contactname &chr(9)& phone &chr(9)& fax &chr(9)& email &chr(9)& passenger1first &chr(9)& passenger1last &chr(9)& passenger1dob &chr(9)& passenger2first &chr(9)& passenger2last &chr(9)& passenger2dob &chr(9)& passenger3first &chr(9)& passenger3last &chr(9) & passenger3dob &chr(9)& passenger4first &chr(9)& passenger4last &chr(9) & passenger4dob &chr(9)& userip &chr(9)& Now())
  265. '    file.Close()    
  266. %>
  267. <%
  268.  
  269. sendemail = true 
  270.  
  271. if sendemail = TRUE then
  272.  
  273. Dim iMsg
  274. Dim iConf
  275. Dim Flds
  276. Dim HTML
  277.  
  278. 'Create the mail object 
  279. Set iMsg = Server.CreateObject("CDO.Message")
  280. set iConf = CreateObject("CDO.Configuration")
  281. Set Flds = iConf.Fields
  282.  
  283. Flds(cdoSendUsingMethod) = cdoSendUsingPort
  284. Flds(cdoSMTPServer) = "127.0.0.1"
  285. Flds(cdoSMTPServerPort) = 25
  286. Flds(cdoSMTPAuthenticate) = 2 
  287. Flds.Update
  288.  
  289.  
  290.     Dim txtSubject
  291.     txtSubject = ""
  292.     txtSubject = txtSubject & "Agency Name: " &agencyname & vbCRLF
  293.     txtSubject = txtSubject & "IATA: " &iata & vbCRLF
  294.     txtSubject = txtSubject & "Address: " &address & vbCRLF
  295.     txtSubject = txtSubject & "City, State, Zip: " &citystatezip & vbCRLF
  296.     txtSubject = txtSubject & "Contact Name: " &contactname & vbCRLF
  297.     txtSubject = txtSubject & "Phone Number: " &phone & vbCRLF
  298.     txtSubject = txtSubject & "Fax Number: " &fax & vbCRLF
  299.     txtSubject = txtSubject & "Email: " &email & vbCRLF & vbCRLF
  300.  
  301.     txtSubject = txtSubject & "Passenger 1 First Name: " &passenger1first & vbCRLF
  302.     txtSubject = txtSubject & "Passenger 1 Last Name: " &passenger1last & vbCRLF
  303.     txtSubject = txtSubject & "Passenger 2 First Name: " &passenger2first & vbCRLF
  304.     txtSubject = txtSubject & "Passenger 2 Last Name: " &passenger2last & vbCRLF
  305.     txtSubject = txtSubject & "Passenger 3 First Name: " &passenger3first & vbCRLF
  306.     txtSubject = txtSubject & "Passenger 3 Last Name: " &passenger3last & vbCRLF
  307.     txtSubject = txtSubject & "Passenger 4 First Name: " &passenger4first & vbCRLF
  308.     txtSubject = txtSubject & "Passenger 4 Last Name: " &passenger4last & vbCRLF & vbCRLF
  309.  
  310.     txtSubject = txtSubject & "ArrivalCity: " &arrivalcity & vbCRLF & vbCRLF
  311.     txtSubject = txtSubject & "Departure Date: "&arrival_select1 & vbCRLF & vbCRLF
  312.     txtSubject = txtSubject & "Departure Date: "&arrival_select2 & vbCRLF & vbCRLF
  313.     txtSubject = txtSubject & "Departure Date: "&arrival_select3 & vbCRLF & vbCRLF
  314.     txtSubject = txtSubject & "Departure Date: "&arrival_select4 & vbCRLF & vbCRLF
  315.     txtSubject = txtSubject & "Departure Date: "&arrival_select5 & vbCRLF & vbCRLF
  316.     txtSubject = txtSubject & "Return City: " &returncity & vbCRLF & vbCRLF
  317.     txtSubject = txtSubject & "Return Date: " &return7 & vbCRLF & vbCRLF
  318.     txtSubject = txtSubject & "Return Date: " &return8 & vbCRLF & vbCRLF
  319.     txtSubject = txtSubject & "Return Date: " &return9 & vbCRLF & vbCRLF
  320.     txtSubject = txtSubject & "Return Date: " &return10 & vbCRLF & vbCRLF
  321.     txtSubject = txtSubject & "Return Date: " &return11 & vbCRLF & vbCRLF    
  322.     txtSubject = txtSubject & "Business: " &business & vbCRLF & vbCRLF
  323.     txtSubject = txtSubject & "Pickup Location: "&pickuplocation & vbCRLF & vbCRLF
  324.     txtSubject = txtSubject & "Dropoff Location: "&dropofflocation & vbCRLF & vbCRLF
  325.     txtSubject = txtSubject & "Upgrade Car: "&carupgrade & vbCRLF & vbCRLF
  326.     txtSubject = txtSubject & "Car Type: "&cartype & vbCRLF & vbCRLF
  327.     txtSubject = txtSubject & "Extension: "&extension & vbCRLF & vbCRLF
  328.     txtSubject = txtSubject & "Extras: " &extras &vbCRLF & vbCRLF
  329.     txtSubject = txtSubject & "Insurance: "&insurance & vbCRLF & vbCRLF
  330.     txtSubject = txtSubject & "Date: " &now() &vbCRLF
  331.  
  332. 'HTML = "<html><body>
  333. '        Agency Name: &agencyname<br>
  334. '        IATA: &iata<br>
  335. '        Address: &address<br>
  336. '        City, State, Zip: &citystatezip<br>
  337. '        Contact Name: &contactname<br>
  338. '        Phone Number: &phone
  339. '        Fax Number: &fax<br>
  340. '        Email: &email<br><br>
  341. '    
  342. '        Passenger 1 First Name: &passenger1first<br>
  343. '        Passenger 1 Last Name: &passenger1last<br>
  344. '        Passenger 2 First Name: &passenger2first<br>
  345. '        Passenger 2 Last Name: &passenger2last<br>
  346. '        Passenger 3 First Name: &passenger3first<br>
  347. '        Passenger 3 Last Name: &passenger3last<br>
  348. '        Passenger 4 First Name: &passenger4first<br>
  349. '        Passenger 4 Last Name: &passenger4last<br><br>
  350. '        
  351. '        Destination: &destination<br>
  352. '        Departure Date: &departuredate<br>
  353. '        Return: &return<br>
  354. '        Return Date: &returndate<br>
  355. '        Insurance: &insurance<br><br>
  356. '        
  357. '        Date: &now()<br>
  358. '    </body></html>"
  359.  
  360.     With imsg
  361.         set .Configuration = iConf
  362.         .AutoGenerateTextBody = true
  363. '        .Fields("urn:schemas:httpmail:importance").Value = 1
  364. '        .Fields.Update()
  365.         .To = "car@ef-usa.com"
  366. '        .bcc = "car@ef-usa.com"
  367.         .From = "car@ef-usa.com"
  368.         .Subject = "Booking Request EFV (Car Rental)"
  369. '        .HTMLBody = txtSubject
  370.         .TExtBody = txtSubject
  371. '        .AddAttachment "C:\files\a.doc"
  372.         .Send
  373.     End With
  374.  
  375.  
  376. 'Create the mail object 
  377. Set iMsg = Server.CreateObject("CDO.Message")
  378. set iConf = CreateObject("CDO.Configuration")
  379. Set Flds = iConf.Fields
  380.  
  381. Flds(cdoSendUsingMethod)  = cdoSendUsingPort
  382. Flds(cdoSMTPServer)       = "127.0.0.1"
  383. Flds(cdoSMTPServerPort)   = 25
  384. Flds(cdoSMTPAuthenticate) = 2 
  385. Flds.Update
  386.  
  387.  
  388.     txtSubject = ""
  389.     txtSubject = ""& contactname &", thank you  for your interest in booking the Car Rental offered by Eurofly. Your reservation request has been submitted. One of our representatives will contact you shortly. Thank you for choosing Eurofly, the best way to fly to Italy!"
  390.  
  391.    With imsg
  392.        set .Configuration = iConf
  393.         .AutoGenerateTextBody = true
  394. '        .Fields("urn:schemas:httpmail:importance").Value = 1
  395. '        .Fields.Update()
  396.         .To = email
  397. '         .bcc = "car@ef-usa.com"
  398.         .From = "EF-USA Car Rentals<car@ef-usa.com>"
  399.         .Subject = "Booking Request (Car Rental)"
  400. '        .HTMLBody = txtSubject
  401.         .TExtBody = txtSubject
  402. '        .AddAttachment "C:\files\a.doc"
  403.         .Send
  404.     End With
  405.  
  406.  
  407. Set iMsg = Nothing
  408. Set iConf = Nothing
  409. Set Flds = Nothing
  410.  
  411. end if
  412.  
  413. %>
  414.         <table width="650"  border="0" cellspacing="0" cellpadding="0">
  415.            <tr valign="top">
  416.              <td width="100"></td>
  417.          </tr>
  418.          <tr>
  419.            <td>
  420.            <p><font face="Arial">Thank you for your interest in booking the Car Rental offered by Eurofly.</p>
  421.            <p>Your reservation request has been submitted. One of our representatives will contact you shortly.</p>
  422.            <p>Thank you for choosing Eurofly, the best way to fly to Italy!</p></font></td>
  423.           </tr>
  424.         </table>
  425.  
  426.  
  427. <%
  428.     else
  429.         Response.Write("<p class=otherfont>You are missing the following below:</p>")
  430.         Response.Write("<p class=otherfont>" & errmsg & "</p>")
  431.         Response.Write("<p class=otherfont>Please go <a href='javascript:history.go(-1);'>back</a> and include them.</p>")    
  432.     end if
  433. %>        
  434.     </body>
  435. </html>
Mar 25 '09 #1
3 2188
debasisdas
8,127 Recognized Expert Expert
Posting 435 lines of code is not a good idea, specially all those commented lines. I don't think anyone is going to read all those.
Mar 26 '09 #2
myjoyce71
1 New Member
Yes If you look up Drop Down Lists in Javascript you'll see you can't just reference the "Value". You need to iterate through all the options and see which is selected (It's a pain). I'm sure VBscript is similiar

If you're having problems with the form to email part I'd suggest using http://www.formmailhosting.com. They will do that part and let you build the form using their online form builder. Results are emailed to you plus they store them in MS Excel format too.

Good Luck with your project

Mark
Founder:
Internet Uptime Monitor - Free Website Uptime Monitoring
http://www.internetuptimemonitor.com
Mar 26 '09 #3
ibeehbk
3 New Member
I want to copy an onChange element dropdown menu info into a hidden field
Then I can just call that hidden field. Would that work? If so, how exactly would I do that?

--------------------------------------------------------------------------------
I want to copy an onChange element dropdown menu info into a hidden field. However, I'm not sure exactly how to go about this. There are some snippets of code below. Basically I want to copy arrivalcity and returncity into two hidden fields of their own, which can later be retrieved by a VBScript. Any help would greatly be appreciated!

<script type="text/javascript">
function change()
{
var arrivalcity = document.getElementById('arrivalcity');
var option1 = document.getElementById('select1');
var option2 = document.getElementById('select2');
var option3 = document.getElementById('select3');
var option4 = document.getElementById('select4');
var option5 = document.getElementById('select5');

switch (arrivalcity.value)
{
case "1":
option1.style.display='block';
option2.style.display='none';
option3.style.display='none';
option4.style.display='none';
option5.style.display='none';
break;
case "2":
option1.style.display='none';
option2.style.display='block';
option3.style.display='none';
option4.style.display='none';
option5.style.display='none';
break;
case "3":
option1.style.display='none';
option2.style.display='none';
option3.style.display='block';
option4.style.display='none';
option5.style.display='none';
break;
case "4":
option1.style.display='none';
option2.style.display='none';
option3.style.display='none';
option4.style.display='block';
option5.style.display='none';

break;
case "5":
option1.style.display='none';
option2.style.display='none';
option3.style.display='none';
option4.style.display='none';
option5.style.display='block';
break;

}
}

function return_change()
{
var returncity = document.getElementById('returncity');
var option7 = document.getElementById('select7');
var option8 = document.getElementById('select8');
var option9 = document.getElementById('select9');
var option10 = document.getElementById('select10');
var option11 = document.getElementById('select11');

switch (returncity.value)
{
case "7":
option7.style.display='block';
option8.style.display='none';
option9.style.display='none';
option10.style.display='none';
option11.style.display='none';
break;
case "8":
option7.style.display='none';
option8.style.display='block';
option9.style.display='none';
option10.style.display='none';
option11.style.display='none';
break;
case "9":
option7.style.display='none';
option8.style.display='none';
option9.style.display='block';
option10.style.display='none';
option11.style.display='none';
break;
case "10":
option7.style.display='none';
option8.style.display='none';
option9.style.display='none';
option10.style.display='block';
option11.style.display='none';

break;
case "11":
option7.style.display='none';
option8.style.display='none';
option9.style.display='none';
option10.style.display='none';
option11.style.display='block';
break;

}
}
</script>

<body>
<select name="arrivalcity" size="1" id="arrivalcity" onChange="change()">
<option selected>please select</option>
<option value="1">Rome</option>
<option value="2">Naples</option>
<option value="3">Palermo</option>
<option value="4">Catania</option>
<option value="5">Other</option>
</select>



<select name="returncity" size="1" id="returncity" onChange="return_change()">
<option selected>please select</option>
<option value="7">Rome</option>
<option value="8">Naples</option>
<option value="9">Palermo</option>
<option value="10">Catania</option>
<option value="11">Other</option>
</select>
</body>
Mar 26 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
1492
by: Ray Gibbon | last post by:
Testing conditions. Common scenario. Old programmer, new to Python, love it, but still hankering after some of my old ways. Of all of it's 'new to me' features, I appear to be enjoying 'no...
2
4518
by: James | last post by:
Are there any style elements that work on select elements on Apple/IE? I want colored text, colored background, or just about anything colored in a select drop-down but can't seem to make it work...
0
4050
by: Francis Parsons | last post by:
Hi! I'm doubtful there's a workaround for this problem, but it's worth a shot. I'm using IE's (css) "zoom" property to zoom the body of a document (in conjunction with persistance so the...
2
1940
by: Dave Hammond | last post by:
I'm not sure if this is technically a javascript question, but I'm coding in javascript, so I'll try here first. To overlay a section of a page I typically use an absolute positioned <div> and...
1
2949
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio...
1
1874
by: javidride | last post by:
When i render a overlib popup, it appears behind select elements. I would like get a good solution to solve this problem.
17
16988
by: Sam Kong | last post by:
Hello, There are 1 or more select elements with the same name in a form. Let's say that the name of the select is 'select1' and the name of the form is 'form1'. If there's only one select I...
5
1771
by: mixey | last post by:
Hi gurus, I have following code: <select id="edit-field-color-tids" class="form-select" multiple="multiple" name="field_color"> <option value="362">ffcedc</option> <option...
1
3043
by: karuppiah | last post by:
Hi All, i need query,how to select last 3 month ,last 3wek,last 3 days , this last 3 month and 3 week should be friday, using sysdate from dual table, there is no exsting table, pls any one help...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.