Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2006, 08:58 AM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with autosuggestion

hi to all

I am building an intranet web aplication in vb from visual studio 2005.

I am trying to add a autosuggest feature to a textbox.

I found at "http://www.nczonline.net/" a script, made by Nicholas Zakas in javascript, that adds the autosuggest feature to a textbox. it works fine but the dropdown created apears hidden by dropdowns or listboxs.

i already put in the css file the div z-index at 9999...

what i would like to now is if someone face the same problem and found the solution and could give me some help

In my net research i found out that one way to put a div over a dropdown or listbox is to put the div inside an iframe

I am trying to change mr zakas script but not getting any results

in javascript i not very good

tnaks for the replays and time.

carlos sousa
 
Old November 13th, 2006, 10:52 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I'm afraid that's nothing to do with the autosuggest, that's how SELECT boxes are in some browsers. You need to hide the dropdown using styles when the autosuggest is in action. IE7 has fixed this issue as I believe have others so in a couple of years it will go away.

--

Joe (Microsoft MVP - XML)
 
Old November 13th, 2006, 11:07 AM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks joe fawcett for the replay

i already achived the first part (10 minutes ago) putting the suggestion dropdown in front of the others form dropdowns and listbox but code is very laim..

one thing is the object oriented code from nicholas zakas another thing is the "brick" that i add...

(code...)
AutoSuggestControl.prototype.showSuggestions = function (aSuggestions)
    {
    var oDiv = null;
    var oIFrm = null;

    //----- clear contents of the layer
    this.layer.innerHTML = "";

    //***my code
    oIFrm = document.createElement("IFrame");
    oIFrm.setAttribute('id','IFrmDiv');
    oIFrm.style.left = this.getLeft() + "px";
    oIFrm.style.top = (this.getTop() + this.textbox.offsetHeight) + "px";
    oIFrm.style.position = "absolute";
    //***

    for (var i=0; i < aSuggestions.length; i++)
        {
        oDiv = document.createElement("div");
        oDiv.appendChild(document.createTextNode(aSuggesti ons[i]));
        this.layer.appendChild(oDiv);
        }
    this.layer.style.left = this.getLeft() + "px";
    this.layer.style.top = (this.getTop() + this.textbox.offsetHeight) + "px";
    this.layer.style.visibility = "visible";

    //**my code
    oIFrm.style.width = this.layer.offsetWidth;
    oIFrm.style.height = this.layer.offsetHeight;
    oIFrm.style.zIndex = 9998;
    oIFrm.style.display = "block";
    document.body.appendChild(oIFrm);
    //***
    };
(...)

will try to understand this prototype thing (it seems to be the way to add methods)

now i am trying to do the hidding part of the iframe

but at least the something is working....

thanks again for the replay


carlos sousa









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.