users@woodstock.java.net

Re: autocomplete feature for textfield not working?

From: Dmitry Kushner <Dmitry.Kushner_at_Sun.COM>
Date: Fri, 04 Apr 2008 20:04:56 -0600


autozoom wrote:
in IE 7 it has an even more weird behaviour: a strange table with "clear" and
"close" link appears under the textfield, and this hides the autocomplete
field when I start to type.
  
please see comments in
https://woodstock.dev.java.net/issues/show_bug.cgi?id=1167
this is FirebugLite
then I often get javascript errors, so that this is quite unusable...I think
this is a prerelease just for testing, or maybe I am doing something wrong
  
if you do get errors please file an issue. But please make sure that errors are part of Woodstock code, as oppose to any example I could have sent as demonstration - demonstration also contains quite a bit of javascript. TextField autoComplete feature is tested as part of  woodstock test application on IE, FF, Safari, etc.
Given this, I don't think it's good to file these as bugs


Dmitry Kushner wrote:
  


  




autozoom wrote:

  Now this seems to work
The listbox displaying the items is overlapped to the textfield, at least
in
Firefox.
  

please file the bug 

  On the other side, this seems to be an integration of the tutorial that
appeared on netbeans site some time ago...doing an autocomplete field with
a
textfield+listbox is not very appealing and good looking.

I was sincerely hoping that something more elaborated was made available
as
a component.

thanks for you help


Dmitry Kushner wrote:
  
  
    


  


Please see details and sample code for configuring Woodstock Ajax
functionality with JSF components ( autocomplete) at newly posted
http://blogs.sun.com/dmitry/entry/configuring_ajax_functionality_in_woodstock  


Dmitry Kushner wrote:

  
I will write and a post a stand-alone example with auto-complete. Will
send the note to this alias. 
  
autozoom wrote:
  
    I think I made things right as explained by the documentation. The
problem
here is that I don't even see any ajax call while typing, so the issue is
not on the code side I guess.

Can you explain how you got it to work please?


Bill Edwards - Sun BOS Software wrote:
  
    
      I have been able to make it work using in my PHP test.   This was 
version 4.2.

Cathy Mucci wrote:
    
      
        I'm not sure if this will help or not.  I received this info a few 
days back on adding autocomplete code to a test I'm working on:

From Dmitry:

Using autocomplete is 2-step process. See attachment below for 
excerpts from TLD docs, but in short autoComplete and 
autoCompleteExpression must be defined.

In order to use it, fields must be bound like this:
        autoComplete="true"
        autoCompleteExpression = "#{AutoCompleteBean.getOptions}"

where  AutoCompleteBean is
 &amp;lt;managed-bean&amp;gt;
        &amp;lt;description&amp;gt;The backing bean for the field
autoComplete 
example&amp;lt;/description&amp;gt;
       
&amp;lt;managed-bean-name&amp;gt;AutoCompleteBean&amp;lt;/managed-bean-name&amp;gt;

&amp;lt;managed-bean-class&amp;gt;autocomplete.AutoCompleteBean&amp;lt;/managed-bean-class&amp;gt;
       
&amp;lt;managed-bean-scope&amp;gt;session&amp;lt;/managed-bean-scope&amp;gt;
    &amp;lt;/managed-bean&amp;gt;


"Attribute indicating to turn on/off the autocomplete functionality of 
the TextField. Autocomplete would trigger the AJAX request to the 
component.

Autocomplete will submit the content of the text field for server side 
processing that will be processed using JSFX partial lifecycle cycle. 
Providing of autoComplete options remains responsibility of the 
developer. Specifically, autoCompleteExpression needs to be set
By default autocomplete is off."

and for autoCompleteExpression :


" Use the autoCompleteExpression to specify the method that will 
filter an autoCompleteExpression list, i.e. to produce new set of 
options to be rendered as autoComplete prompts ( see 
autoCompleteExpression) . When autoComplete mechanism is enabled ( by 
specifying autoComplete attribute), autoCompleteExpression method will 
be called using the Ajax mechanism in the background every time user 
changes the content of the field. Note that this requires 
autoCompleteExpression method to perform well. Also, it is recommended 
to limit number of options available to user as the return of this 
method - both for usability and in order to increase download speed.

The value of autoCompleteExpression must be an EL expression and it 
must evaluate to the name of a public method that is defined by 
com.sun.webui.jsf.model.AutoComplete, something like: public Options[] 
getOptions(String filter) { ... } In this example, expression would 
look like this: &amp;lt; webuijsf:textField autoComplete = "true" 
autoCompleteExpression ="#{AutoCompleteBean.getOptions}" 
text="#{AutoCompleteBean.text}" label = "AutoComplete" id = "tf" /&amp;gt;

"


autozoom wrote:
      
        
          hello,
I tried the autocomplete function in 4.2 build 5, like this:

&amp;lt;webuijsf:textField autoComplete="true" id="textField1"
style="position:
absolute; left: 180px; top: 252px"
                        autoCompleteExpression
="#{Page1.getOptions}"/&amp;gt;

where
public Option[] getOptions(String filter) {
         Option[] ret = new Option[3];
                  ret[0] = new Option(1L, "uno");
         ret[1] = new Option(2L, "due");
         ret[2] = new Option(3L, "tre");
                  return ret;
}

but nothing happens when typing in the textfield; it doesn't seem to 
be a
problem of code, it just doesn't fire any ajax call when typing

what am I missing?
        
        
              
      
     
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@woodstock.dev.java.net  
For additional commands, e-mail: users-help@woodstock.dev.java.net  



    
    
    
  
  
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@woodstock.dev.java.net  
For additional commands, e-mail: users-help@woodstock.dev.java.net  




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@woodstock.dev.java.net 
For additional commands, e-mail: users-help@woodstock.dev.java.net 



    
  
  
  




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@woodstock.dev.java.net
For additional commands, e-mail: users-help@woodstock.dev.java.net