Re: AutoCompleteTextField: Making Wicket call getChoices method on 'onClick' event

2008-11-10 Thread bruno . borges
Take a look at the source code of AutoCompleteTextField and find out which  
JS method is called to display the list of choices.
Then from this point, you can use the onFocus javascript event  
(http://www.w3schools.com/jsref/jsref_onfocus.asp).


Cheers,
Bruno

On Nov 9, 2008 9:01pm, m_salman <[EMAIL PROTECTED]> wrote:



Hi,



I need some help with the AutoCompleteTextField. I would like it to show

the choice list when some one clicks in the field not just when the user

type a letter or two. I find that, atleast in my case, when I click on the

field getChoices method is not called.



I have tried some thing such as adding 'onClick' ajax event. But it does  

not


seem to work.



Below is my code and I will gretaly appreciate any help.



Thanks,



-Mohammad





private void addAutoCompleteTextField(

final PresenterParameterText presenter)

{

AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings();

autoCompleteSettings.setShowListOnEmptyInput(true);





final AutoCompleteTextField textField

= new AutoCompleteTextField(

"value",

new PropertyModel(presenter, "value"),

autoCompleteSettings)

{

@Override

protected Iterator getChoices(String input)

{

List list;

try

{

//list = ..

//return list.iterator();

}

catch (Throwable t)

{

getRequestCycle().setRedirect(true);

throw new RestartResponseException(new ErrorPage(t));

}

}

};



add(textField);



textField.setOutputMarkupPlaceholderTag(true);

textField.add( new AjaxEventBehavior("onclick")

{

@Override

protected void onEvent(AjaxRequestTarget

target)

{

presenter.setValue("");

target.addComponent(textField);



// How do I fire the event to call

the textFields getChoices method ???

}

});





}

--

View this message in context:  

http://www.nabble.com/AutoCompleteTextField%3A-Making-Wicket-call-getChoices-method-on-%27onClick%27-event-tp20411983p20411983.html


Sent from the Wicket - User mailing list archive at Nabble.com.





-

To unsubscribe, e-mail: [EMAIL PROTECTED]

For additional commands, e-mail: [EMAIL PROTECTED]





AutoCompleteTextField: Making Wicket call getChoices method on 'onClick' event

2008-11-09 Thread m_salman

Hi,

I need some help with the AutoCompleteTextField.  I would like it to show
the choice list when some one clicks in the field not just when the user
type a letter or two.  I find that, atleast in my case, when I click on the
field getChoices method is not called.  

I have tried some thing such as adding 'onClick' ajax event. But it does not
seem to work.

Below is my code and I will gretaly appreciate any help.

Thanks,

-Mohammad


private void addAutoCompleteTextField(
final PresenterParameterText presenter)
{
AutoCompleteSettings autoCompleteSettings = new 
AutoCompleteSettings();
autoCompleteSettings.setShowListOnEmptyInput(true);


final AutoCompleteTextField textField 
= new AutoCompleteTextField(
"value", 
new 
PropertyModel(presenter, "value"),
autoCompleteSettings)
{
@Override
protected Iterator getChoices(String 
input)
{
List list;
try
{
//list = .. 

   
//return list.iterator();   
}
catch (Throwable t)
{

getRequestCycle().setRedirect(true); 
throw new 
RestartResponseException(new ErrorPage(t)); 
  
}   
}   
};

add(textField);

textField.setOutputMarkupPlaceholderTag(true);
textField.add(  new AjaxEventBehavior("onclick") 
{
@Override
 protected void onEvent(AjaxRequestTarget
target) 
{
 presenter.setValue("");
 target.addComponent(textField);

   // How do I fire the event to call
the textFields getChoices method ???
}
   });


}
-- 
View this message in context: 
http://www.nabble.com/AutoCompleteTextField%3A-Making-Wicket-call-getChoices-method-on-%27onClick%27-event-tp20411983p20411983.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]