Hi, have you tried moving FeedbackPanel out of fragment? You could put
it at the end of the form like this:
<form>
...
<div wicket:id="feedback">
</div>
</form>
and then you could add it directly to form:
form.add(new RedFeedbackPanel("feedback"));
My Problem is the correct display of a feedbackpanel.
The feedbackpanel is defined in a fragment component.
I have a page including a form including a fragment including a repeater
(DataView).
The DataView creates textfields in the populateItem() method.
The textfields are set to required=true.
I want to validate and display the textfield when submitting the form.
Problem: I get following message and no feedbackpanel:
(WebSession.java:193) -Component-targetted feedback message was left
unrendered. This could be because you are missing a FeedbackPanel on the
page.
Message: [FeedbackMessage message = " error message ...", reporter = tfi,
level = ERROR]
But:
When I set an Ajax event on the textfield e.g.
AjaxFormComponentUpdatingBehavior("onblur") and
call target.addComponent(feedbackPanel); in onUpdate() method the
feedbackpanel is displayed correctly.
How is it possible to display the feedback panel when doing a "normal" form
submit without ajax ?
It seems to be the problem that the textfield components are created
dynamically and they don't know their feedbackpanel !?
Is there a solution to set the textfields the feedbackpanel (without ajax) ?
Thanks for hints!
Ralph
see my code example:
public class MyPage extends WebPage {
public MyPage() {
Form form = new Form("form") {
@Override
protected void onSubmit() {
setResponsePage(IndexPage.class);
}
@Override
protected void onError() {
...
}
}
form.add(new MyFragment("fragment"));
Button btnSave = new Button("btnSave", "Save");
form.add(btnSave);
this.add(form);
}
}
public class MyFragment extends Fragment {
private FeedbackPanel feedbackpanel;
public MyFragment1(String id) {
super(id, "fragment1", MyPage.this);
feedbackpanel = new FeedbackPanel("feedback1",
new
ContainerFeedbackMessageFilter(this));
add(feedbackpanel);
myContainer = new WebMarkupContainer("myContainer");
myContainer.add(new MyDataViewTable("tblList", list));
add(myContainer);
}
}
Here my DataView - Repeater populateItem method:
protected void populateItem(Item item) {
...
TextField tfi = new TextField<String>();
tfi.setRequired(true);
tfi.add(new AjaxFormComponentUpdatingBehavior("onblur") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.addComponent(feedbackPanel);
}
@Override
protected void onError(AjaxRequestTarget target,
RuntimeException e) {
target.addComponent(feedbackPanel);
}
});
item.add(tfi);
...
}
My Markup:
<html>
<head>
...
</head>
<body>
<form wicket:id="form">
<div wicket:id="content" />
<wicket:fragment wicket:id="fragment1">
<fieldset id="xyz">
<table width="100%" cellspacing="0" cellpadding="2" class="foo"
wicket:id="myContainer">
<tr class="odd" wicket:id="tblList">
<td><input wicket:id="tfiField1" id="l0"
name="l0" type="text"
maxlength="35"></td>
<td><input wicket:id="tfiField2" id="l1"
name="l1" type="text"
maxlength="35"></td>
<td><input wicket:id="tfiField3"i d="l2"
name="l2" type="text"
maxlength="35"></td>
<td><input wicket:id="tfiField4" id="l3"
name="l3" type="text"
maxlength="35"></td>
</tr>
</table>
</fieldset>
</wicket:fragment>
</form>
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org