Nightmare Auto complete & values

Discussion in 'JavaScript' started by aiden857, May 7, 2007.

  1. #1
    Hi all im looking for some help on bit of script. OK so this what i have. 1 drop down list using street names for discription & values, 1 auto complete box that when you type the first few letters it finds a match to the valu in the drop down list. now what i need is a 3rd field called amount that when you either enter the name in the auto complete box or select the street name from the drop down box It will give you a price eg:€200. This is the script so fare can some one tell me what to do next as i have already assigned the value of the dropdown box the fuction for auto complete. PLEASE HELP.

    Kind Regards
    Aiden
    :eek:
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-<option>" />
    <title>Untitled Document</title>




    <script>
    <!--



    function autoComplete (field, select, property, forcematch) {
    var found = false;
    for (var i = 0; i < select.options.length; i++) {
    if (select.options[property].toUpperCase().indexOf(field.value.toUpperCase()) == 0) {
    found=true; break;
    }
    }
    if (found) { select.selectedIndex = i; }
    else { select.selectedIndex = -1; }
    if (field.createTextRange) {
    if (forcematch && !found) {
    field.value=field.value.substring(0,field.value.length-1);
    return;
    }
    var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;";
    if (cursorKeys.indexOf(event.keyCode+";") == -1) {
    var r1 = field.createTextRange();
    var oldValue = r1.text;
    var newValue = found ? select.options[property] : oldValue;
    if (newValue != field.value) {
    field.value = newValue;
    var rNew = field.createTextRange();
    rNew.moveStart('character', oldValue.length) ;
    rNew.select();
    }
    }
    }
    }
    //-->
    </script>

    </head>

    <body>
    <p>&nbsp;</p>
    <form id="form<option>" name="form<option>" method="post" action="contact.php">
    <label><input type= "text" name="input12" value="" onkeyup="autoComplete(this,this.form.options,'value',true)" />
    </label>

    <select name= "options" onchange="this.form.input12.value=this.options[this.selectedIndex].value">
    <option value="Abbey Park" var="200">Abbey Park</option>
    <option value="Abbotstown Ave.">Abbotstown Ave.</option>
    <option value="Adelaide Rd.">Adelaide Rd.</option>
    <option value="Ailesbury Rd.">Ailesbury Rd.</option>
    <option value="Airport (Dublin)">Airport (Dublin)</option>
    <option value="Albert Rd.">Albert Rd.</option>
    <option value="Alexandra Basin (Ext. Gates)">Alexandra Basin (Ext. Gates)</option>
    <option value="Alexandra Rd.">Alexandra Rd.</option>
    <option value="All Saints Rd.">All Saints Rd.</option>
    <option value="Allenton Estate">Allenton Estate</option>
    <option value="Amiens St.">Amiens St.</option>
    <option value="Angelsea">Angelsea</option>
    <option value="Annamoe Rd.">Annamoe Rd.</option>
    <option value="Anne Devlin Pk.">Anne Devlin Pk.</option>
    <option value="Appian Way">Appian Way</option>
    <option value="Ardee St.">Ardee St.</option>
    <option value="Ardlea Rd.">Ardlea Rd.</option>
    <option value="Artane">Artane</option>
    <option value="Artane Shopping Centre">Artane Shopping Centre</option>
    </select>
    <input name="amount" type="text" value"" readonly=""/>
    <label></label>
    </form>

    </p>
    <label></label>
    <p>
    <label></label>
    </p>
    </body>
    </html>
     
    aiden857, May 7, 2007 IP
  2. tomermolo

    tomermolo Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    My company has developed a Search Assist tool that displays search suggestions, RSS feeds and contextual advertisements on websites and mobile devices as a visitor is typing a search query (a similar feature has recently been added on Yahoo’s homepage). PredictAd’s ability to learn a site’s content and community search patterns allow us to display the appropriate content to the user in real-time.

    Please view PredictAd’s customized demo on Seth Godin's blog at: http://tinyurl.com/yq9e5m . This is a generic demo but will give you a basic idea of the functionality. Start typing in the search box to see PredictAd in action - click on the RSS tab to see keyword-related RSS feeds.

    Thanks, I’ll be happy to provide additional information at your request. I look forward to your feedback.
     
    tomermolo, Dec 19, 2007 IP