1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Nightmare Auto Complete & Values?

Discussion in 'Programming' 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

    <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