Igor, unfortunely I haven't been able to use the solution proposed. I copied 
and pasted the code for the getCallbackUrl method but it had a minor typo, but 
after I corrected and reloaded the page with the autocomplete field the browser 
(IE) throws a javascript error. The following works (using a hard code value) :

return super.getCallbackUrl() + "&limiter=1415"; 

but If I use this :

return super.getCallbackUrl() + "' + '&numeroFact=' + 
document.getElementById('numero').value + '";

or

return super.getCallbackUrl() + "&numeroFact=' + 
document.getElementById(\"numero\").value + '";

I get an "" when getting the parameter from the request.

The code generated in the page is the following :


new Wicket.AutoComplete('indexForm_proveedores',

'/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListener&wicket:behaviorId=1&wicket:ignoreIfNotActive=true&limiter='
 + document.getElementById('numero').value + '');

It seems the retrieval of the field is returning null !.

The field is defined as follows in the page :

<input wicket:id="numero" type="text" class="tipo" size="12">

and in the Java code :

add(new TextField("numero")
              {
                        public String getMarkupId()
                        {
                             return "numero";
                        }
                    }.add(new NumeroFacturaValidador()).
                      add(StringValidator.maximumLength(12)).
                      setOutputMarkupId(true).add(new FieldFocusBehavior()));


I don't know what I'm doing wrong, any help would be greatly appreciated.

Jaime.







Jaime De La Jara <[EMAIL PROTECTED]> wrote: Absolutely !, thanks a lot Igor, 
I'll try it right now. I agree that is an uncommon use case and it doesn't 
deserve an api change and a custom solution is what is needed.

Jaime.

Igor Vaynberg <[EMAIL PROTECTED]> wrote: ok, this is a bit tricky but is def 
doable. i dont think this is a very common usecase, so i dont think we will 
create all the factories/etc for you to be able to do this out of the box 
because in most cases it will just be api bloat. 

that said, although not trivial it is still def very possible

start with extending the autocompletebehavior
override getcallbackurl and do something like
return 
super.getcallbackurl()+"+'&limiter='+document.getelementbyid('someid').value"); 

so now whenever the url is invoked for the autocomplete it will also contain a 
"limiter" param whose value  will be the value of that textfield - make sure 
someid is the id of that textfield.

then simply create your own component, or add the behavior directly to a 
textfield, see AutoCompleteTextField source - its rather trivial. 

now in your getchoices() you can do getrequest().getparameter("limiter") and 
that will give you that extra value you need to filter

make sense?

-igor


 On 3/26/07, Jaime De La Jara <[EMAIL PROTECTED]> wrote: Basically what I need 
is to narrow the possible choices of the autocomplete field, depending on the 
value the user entered in the other field (which is a normal field).
This is a user requirement to simplify their data entry, in this case the 
normal field is an  invoice number and the autocomplete field corresponds to 
the vendor name, so if the user enters invoice number 0189, and in the 
autocomplete he types "E" the list displayed should show only the vendors whose 
name start with an "E" and 
have an invoice numbered 0189.
Thanks,

Jaime.

Igor Vaynberg < [EMAIL PROTECTED]> wrote:
 On 3/26/07,  Jaime De La Jara <[EMAIL PROTECTED]> wrote:
  Hi, I have a form with some fields and a AutoCompleteTextField that is 
working nice, however now I need to retrieve the value of a TextField from this 
AutoCompleteTextField so I can restrict the values shown for autocompletion. Is 
this possible?   
umm...isnt that what the autocomplete is for? you are in control of the 
choices, so why would you need to further restrict them?

-igor

 

  in the affirmative case, could you give me a hint?
Thanks,

Jaime.
   

---------------------------------
Don't be flakey.  Get Yahoo! Mail for Mobile and 
 always stay connected to friends. 

------------------------------------------------------------------------- 
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your 
opinions on IT & business topics through brief surveys-and earn cash
  http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 
_______________________________________________
Wicket-user mailing list
 Wicket-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/wicket-user 


 

 -------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your 
opinions on IT & business topics through brief surveys-and earn cash
  
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user 

   

---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile  and 
always stay connected to  friends.

------------------------------------------------------------------------- 
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
 http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/wicket-user

 

 -------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

     

---------------------------------
Looking for earth-friendly autos? 
 Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.  
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


 
---------------------------------
The fish are biting.
 Get more visitors on your site using Yahoo! Search Marketing.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to