coldfusion help plz

Discussion in 'Web Design & Coding' started by daraptor, Jun 22, 2006.

  1. daraptor

    daraptor OSNN Junior Addict

    Messages:
    12
    hey guyz am tryin to design a travel search website.the problem is....i am unable to populate text parent window from the child window.am gonna need some help guyz plz....i dont know the script for that process.am attaching my parent file and child file in this so that u can take a look at that....i have created a database of airport codes and given the path to that in the child file...evrything is ok but when i select the airport code wanted it does not populate the parent window.....can someone help me with this plz.....the name of the parent file is (index.cfm) and the name of child file is (airport_codes.cfm) and the name of my db file is airports....if u need any more details about that i will be happy to give them to u.....jss email me to elivalaparla@gmail.com for the details .. am also attaching my db file for ur convenience....plz help me with this guyz

    **************parent file****************
    <cfoutput>
    <cfform name="TravelSearch" format="flash" width="350" height="500">
    <cfformgroup type="Panel" label="Ticket Search">
    <cfformgroup type="TabNavigator" width="330" height="450">
    <cfformgroup type="page" label="Flights" >

    <cfformgroup type="Tile">
    <cfformgroup type="Horizontal">
    <cfinput type="Radio" name="flightType" value="FlightOnly" label="Flight Only">
    <cfinput type="Radio" name="flightType" value="FlightAndHotel" label="Flight + Hotel">
    </cfformgroup>
    </cfformgroup>
    <cfformitem type="HRule"/>

    <cfformgroup type="Horizontal">
    <cfformitem type="html">
    city name or <a href="airport_codes.cfm" target="New window">Airport Codes</a>
    </cfformitem>
    </cfformgroup>
    <cfinput type="Text" name="fromCity" label="From:" width="200">
    <cfinput type="Text" name="toCity" label="To:" width="200">
    <cfformitem type="HRule"/>

    <cfinput type="DateField" name="dtLeave" label="Leave:" width="200">
    <cfinput type="DateField" name="dtReturn" label="Return:" width="200">
    <cfformitem type="HRule"/>

    <cfformgroup type="Horizontal" label="Travelers">
    <cfformgroup type="HBox">
    <cfformgroup type="VBox">
    <cfformitem type="Text">Adults (18+)</cfformitem>
    <cfselect name="adults" width="75">
    <option>0</option>
    <option selected>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    </cfselect>
    </cfformgroup>
    <cfformgroup type="VBox">
    <cfformitem type="Text">Kids (0-17)</cfformitem>
    <cfselect name="kids" width="75">
    <option>0</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    </cfselect>
    </cfformgroup>
    </cfformgroup>
    </cfformgroup>
    <cfinput type="Image" name="Flights_searchBtn" src="search.jpg" width="80">
    </cfformgroup>




    <cfformgroup type="page" label="Hotels">
    <cfformgroup type="Horizontal">
    <cfformitem type="html">City, point of interest, or <a href="##" target="_blank"><u>airport code</u></a></cfformitem>
    </cfformgroup>
    <cfinput type="Text" name="hotel_where" label="where" width="200" value="Enter City or Point of Interest"
    onMouseUp="if( hotel_where.text.substring(0,31) == 'Enter City or Point of Interest'){ hotel_where.text=''}" >
    <cfinput type="DateField" name="hotel_checkin" label="Check-In:" width="150">
    <cfinput type="DateField" name="hotel_checkout" label="Check-Out:" width="150">
    <cfselect name="hotel_rooms" label="Rooms:" width="50">
    <option>1</option>
    <option>2</option>
    </cfselect>
    <cfselect name="hotel_guest" label="Guests:" width="50">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>7</option>
    <option>8</option>
    </cfselect>

    <cfformitem type="Text">Optional:</cfformitem>
    <cfformitem type="HRule"/>
    <cfinput type="Text" name="hotel_specifichotel" label="Hotel Name:" width="150">
    <cfselect name="hotel_starRating" label="Star Rating" width="150">
    <option>1 Star</option>
    <option>2 Stars</option>
    <option>3 Stars</option>
    <option>4 Stars</option>
    <option>5 Stars</option>
    </cfselect>
    <cfformgroup type="Vertical" label="Amenities">
    <cfinput type="Radio" name="hotel_amenities" value="Any" label="Any Amenities">
    <cfinput type="Radio" name="hotel_amenities" value="choose" label="Let me choose">
    </cfformgroup>
    <cfinput type="Image" name="Hotels_searchBtn" src="search.jpg" width="80">
    </cfformgroup>



    <cfformgroup type="page" label="Cars">
    <cfformgroup type="Horizontal">
    <cfformitem type="html">City or <a href="##" target="_blank"><u>airport code</u></a></cfformitem>
    </cfformgroup>
    <cfinput type="Text" name="cars_pickup" label="Pick-up" value="Where from?"
    onMouseUp="if( cars_pickup.text.substring(0,11) == 'Where from?'){ cars_pickup.text=''}">
    <cfselect name="cars_pickupoptions" label="">
    <option>At or Near Airport</option>
    <option>In City or Surrounding Area</option>
    </cfselect>
    <cfinput type="Text" name="cars_dropoff" label="Drop Off" value="Same as pickup"
    onMouseUp="if( cars_dropoff.text.substring(0,14) == 'Same as pickup'){ cars_dropoff.text=''}">

    <cfformgroup type="Horizontal" label="Pick-up:">
    <cfinput type="DateField" name="cars_datePickUp" width="100">
    <cfselect name="cars_timePickUp" width="100">
    <cfloop index="hour" from="1" to="11">
    <option>#hour# AM</option>
    </cfloop>
    <option>noon</option>
    <cfloop index="hour" from="1" to="11">
    <option>#hour# PM</option>
    </cfloop>
    </cfselect>
    </cfformgroup>
    <cfformgroup type="Horizontal" label="Drop-off:">
    <cfinput type="DateField" name="cars_dateDropOff" width="100">
    <cfselect name="cars_timeDropOff" width="100">
    <cfloop index="hour" from="1" to="11">
    <option>#hour# AM</option>
    </cfloop>
    <option>noon</option>
    <cfloop index="hour" from="1" to="11">
    <option>#hour# PM</option>
    </cfloop>
    </cfselect>
    </cfformgroup>
    <cfformitem type="Text">Optional:</cfformitem>
    <cfformitem type="HRule"/>

    <cfformgroup type="Horizontal" label="Discounts">
    <cfformitem type="html">
    If you have a corporate or association discount, select the car rental company below.<br>(You'll enter the number on the next screen.)
    </cfformitem>
    </cfformgroup>
    <cfselect name="cars_carRentalCompany" label="Rental Co.">
    <option>Ace</option>
    <option>Advantage</option>
    <option>Alamo</option>
    <option>Avis</option>
    <option>Budget</option>
    <option>Dollar</option>
    <option>Enterprise</option>
    <option>EuropeCar</option>
    <option>Fox Rent</option>
    <option>Hertz</option>
    <option>National</option>
    <option>Payless</option>
    <option>Thrifty</option>
    </cfselect>
    <cfinput type="Image" name="Cars_searchBtn" src="search.jpg" width="80">
    </cfformgroup>

    <!--- :: <cfformgroup type="page" label="Vacations">

    </cfformgroup> :: --->

    </cfformgroup>
    </cfformgroup>
    </cfform>
    </cfoutput>

    *******************************************************

    ********child file****************

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Airport Codes</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script>
    function checkField(){
    var field = document.location.toString();

    if (field.indexOf("?fromCity")!=-1)
    document.forms.locator.action = "search_airport_lookup.jsp?dest";
    document.forms.locator.LOOKUP.focus();
    }

    function fillNom(nom){
    var op = opener.document.forms;
    if (document.location.toString().indexOf("?fromCity")!=-1) op.TravelSearch.elements.fromCity.value = nom;
    else op.TravelSearch.elements.fromCity.value = nom;
    }
    </script>
    </head>

    <body>
    <cfif not isDefined("form.submit")>

    <cfform format="XML" width="200" height="200">
    <cfformgroup type="vertical">
    <cfformitem type="HTML">
    <span style="margin-left:50px">Please enter Airport Code.</span>
    </cfformitem>
    <cfinput id="airport" title="Airport Code" name="airport" size="20" maxlength="50" type="text" label="Airport Code" />
    <cfformitem type="HTML">
    <span style="margin-left:50px"> or Please enter City Name.</span>
    </cfformitem>
    <cfinput id="city" title="City Name" name="city" size="20" maxlength="50" type="text" label="City Name" />
    <cfformitem type="HTML">
    <span style="margin-left:50px">or Please enter Country Name.</span>
    </cfformitem>
    <cfinput id="country" title="Country Name" name="country" size="20" maxlength="50" type="text" label="Country Name" />
    <cfformgroup type="horizontal">
    <cfinput id="submit" title="Submit" name="submit" value="Submit" type="submit" style="margin-left:65px"/>
    <cfinput id="reset" title="Reset" name="reset" value="Reset" type="reset" label="Reset" />
    </cfformgroup>
    </cfformgroup>

    </cfform>

    <cfelse>

    <br><br>
    <cfoutput>
    Name: #form.airport# #form.city# #form.country#
    </cfoutput>
    </cfif>

    <cfquery name="airportQuery" datasource="airports">
    SELECT AP_CODE, AP_CITY, AP_STATE, AP_COUNTRY, AP_NAME
    FROM airport_code
    WHERE AP_CITY = '#form.city#' or AP_COUNTRY = '#form.country#';
    </cfquery>
    <br><br>
    <b>Airport by Airport City</b>

    <table cellpadding="5" cellspacing="0" border="1">
    <tr>
    <th>Code</th>
    <th>City</th>
    <th>State</th>
    <th>Country</th>
    <th>Name</th>
    </tr>
    <cfoutput query="airportQuery">

    <tr>
    <td><a href="javascript:self.close()" onClick="fillNom('#airportQuery.AP_CODE#')" >#airportQuery.AP_CODE#</a></td>
    <td>#airportQuery.AP_CITY#</td>
    <td>#airportQuery.AP_STATE#</td>
    <td>#airportQuery.AP_COUNTRY#</td>
    <td>#airportQuery.AP_NAME#</td>
    </tr>
    </cfoutput>
    </table>
    </body>
    </html>