Re: [Follow up] Ajax link doesn't call event

2008-09-05 Thread only4you

Lack of super section cause that kind of a problem. Look at example:


AjaxEditableLabel label = new AjaxEditableLabel(componentId, new
PropertyModel(dtoUser, loginName)){
  @Override
  protected void onEdit(AjaxRequestTarget 
target) {
super.onEdit(target);

log.debug(ListCopies.ListCopies().loginNameColumn.onEdit:
+dtoUser.getId()+ +dtoUser.getLoginName()+ +dtoUser.getFirstName()+
+dtoUser.getLastName());
  }
  @Override
  protected void onError(AjaxRequestTarget 
target) {
super.onError(target);
target.addComponent(getFeedbackPanel());

log.error(ListCopies.ListCopies().loginNameColumn.onError:
+dtoUser.getId()+ +dtoUser.getLoginName()+ +dtoUser.getFirstName()+
+dtoUser.getLastName());
  }
  @Override
  public void onSubmit(AjaxRequestTarget 
target){
super.onSubmit(target);

log.debug(ListCopies.ListCopies().loginNameColumn.onSubmit:
+dtoUser.getId()+ +dtoUser.getLoginName());
((LibraryApplication)
getApplication()).getManageUser().saveObject(dtoUser);
  }
};





ezegb wrote:
 
   
 @SuppressWarnings(unchecked)
   @Override
   protected void 
 onSubmit(AjaxRequestTarget target, Form form) 
   {
   ProjectProduct 
 projectProduct = (ProjectProduct)
 this.getModelObject(); 
   
 projectProduct.getAuthor().remove(item.getIndex());
   
 target.addComponent(authorContainer);
   }
   
 

-- 
View this message in context: 
http://www.nabble.com/Ajax-link-doesn%27t-call-event-tp18219220p19326851.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]



Re: [Follow up] Ajax link doesn't call event

2008-07-02 Thread ezegb

Hi, thanks for your reply. As I said, the troublesome component seems to be a
container which is composed of the following:

ListView author = new 
CompoundListView(author) 
{
private static final long 
serialVersionUID = 1L;

@Override
protected void populateItem(final 
ListItem item) 
{   
item.add(new Label(name));

// Ajax link to delete the 
current row
AjaxSubmitLink deleteRow = new 
AjaxSubmitLink(deleteRow) 
{

private static final 
long serialVersionUID = 1L;


@SuppressWarnings(unchecked)
@Override
protected void 
onSubmit(AjaxRequestTarget target, Form form) 
{
ProjectProduct 
projectProduct = (ProjectProduct)
this.getModelObject(); 

projectProduct.getAuthor().remove(item.getIndex());

target.addComponent(authorContainer);
}
};
item.add(deleteRow);
}
};
authorContainer.add(author);

final AutoCompleteTextField personName = new
AutoCompleteTextField(personName, new Model())
{   
private static final long 
serialVersionUID = 1L;

@SuppressWarnings(unchecked)
@Override
protected Iterator getChoices(String 
input) 
{
ListString results = new 
ArrayListString();
if (input.length()  
MINAUTCOMPLETEINPUTLENGHT) {

results.add(getLocalizer().getString(search.parameter.too.short,
this));

}
else {
Criteria criteria = new 
Criteria();

criteria.addFilter(lastName, CriteriaOperators.BEGINSWITH, input);


for(PersonInfo p : 
uService.getPersonInfoByCriteria(criteria,
defaultPaginator)) {
//only filter 
professors

results.add(p.getName() +  -  + D.N.I.: + p.getDni());
}
}
if(results.size() == 
MAXAUTOCOMPLETEROWS) {

results.add(getLocalizer().getString(too.many.results, this));
}
return results.iterator();
}
};
authorContainer.add(personName);

// Ajax link to add a row
AjaxSubmitLink addAuthor = new 
AjaxSubmitLink(addAuthor) 
{
private static final long 
serialVersionUID = 1L;

@Override
protected void 
onSubmit(AjaxRequestTarget target,
Form form) 
{
ProjectProduct projectProduct = 
(ProjectProduct)
form.getModelObject();
String name = 
(String)personName.getConvertedInput();
if(name == null)
  

Re: [Follow up] Ajax link doesn't call event

2008-07-02 Thread Timo Rantalaiho
On Wed, 02 Jul 2008, ezegb wrote:
 I'd like to stress that this same code is working elsewhere, though there's
 no lonely textfields beneath in that form, but there are other similar
 containers.

Sorry but it's very hard to get a grasp of the code from the 
email -- at least I couldn't see anything straight away. It 
would be easier for me and others to look at your code in a 
working quickstart project, created e.g. with this

  http://wicket.apache.org/quickstart.html

Off-topic: Hmm, D.N.I.! Are you working in some Latin American
country by any chance?-)

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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



Re: [Follow up] Ajax link doesn't call event

2008-07-02 Thread ezegb

Hi Timo, yes I'm from Argentina, DNI's the Documento Nacional de Identidad :p

Regarding the issue, we did nail it down todays, turns out Ajax was
rejecting the request because of empty required textfields elsewhere in the
form. Now, the following issue is we couldn't quite catch the validation so
as to have the Ajax onSubmit ignore it. I did attempt a naive override of
onError as well as calling this method whose name I cannot find right now
which receives a boolean and if false overrides validation and such and
proceeds directly to onSubmit. Any ideas are appreciated

Thanks,

Ezequiel


Timo Rantalaiho wrote:
 
 On Wed, 02 Jul 2008, ezegb wrote:
 
 Off-topic: Hmm, D.N.I.! Are you working in some Latin American
 country by any chance?-)
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Ajax-link-doesn%27t-call-event-tp18219220p18251429.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]



Re: [Follow up] Ajax link doesn't call event

2008-07-02 Thread Timo Rantalaiho
On Wed, 02 Jul 2008, ezegb wrote:
 Hi Timo, yes I'm from Argentina, DNI's the Documento Nacional de Identidad :p

I thought it rang a bell :)

 Regarding the issue, we did nail it down todays, turns out Ajax was
 rejecting the request because of empty required textfields elsewhere in the
 form. Now, the following issue is we couldn't quite catch the validation so
 as to have the Ajax onSubmit ignore it. I did attempt a naive override of
 onError as well as calling this method whose name I cannot find right now
 which receives a boolean and if false overrides validation and such and
 proceeds directly to onSubmit. Any ideas are appreciated

It's always a good idea to override onError because of this.
I think that with a good onSubmit / onError collaboration 
you can get a good solution. 

Suerte,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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



Re: [Follow up] Ajax link doesn't call event

2008-07-01 Thread ezegb

I ended up commenting loads of code and it turns out my Ajax link will quit
responding if it has something else after itself in the form. I got rid of
all the textfields that followed, and I got it to work. The troublesome
component is actually the ajax link, plus a textfield to input data, plus a
listview displaying that data (the ajax link updates the object and the
listview)

Thanks,

Ezequiel


ezegb wrote:
 
 Hi, the situation is as follows:
 
 I have a form embedded in an abstract panel. The form has an
 autocompletetextfield and an AjaxSubmitLink which acts on the data in the
 textfield. The panel, in turn, extends several other panels which are in
 the end the ones that get instantiated.
 
 The very code for the AjaxSubmitLink is used elsewhere and works fine.
 Now, the issue is that when called on this panel, it won't call its
 onSubmit event. It won't call any other onSubmit event, either. I am
 certain the code is placed in a class extending Form on the Java side, and
 it's certainly enclosed by form in the markup. I'm at a total loss with
 this situation, since it does work in the very same page (the final page
 has two forms, the first one works perfectly, the second -this one- does
 not).
 
 Any help will be most appreciated.
 
 Thanks,
 
 Ezequiel
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Ajax-link-doesn%27t-call-event-tp18219220p18220869.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]



Re: [Follow up] Ajax link doesn't call event

2008-07-01 Thread Timo Rantalaiho
On Tue, 01 Jul 2008, ezegb wrote:
 I ended up commenting loads of code and it turns out my Ajax link will quit
 responding if it has something else after itself in the form. I got rid of
 all the textfields that followed, and I got it to work. The troublesome
 component is actually the ajax link, plus a textfield to input data, plus a
 listview displaying that data (the ajax link updates the object and the
 listview)

If you can provide a quickstart containing only the few
necessary parts, others can try checking it it's a bug or
if you can fix something in your code.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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