Hi James,
This is a shortened list of events happening, including only the ones
affecting you. They are in the order in which they occur.
* IFormSubmitListener#onFormSubmitted()
* ListView#onBeforeRender()
* Page#onRender()
ListView#onBeforeRender() calls ListView#onPopulate(). If you are not
using ListView#setReuseItems(true), then ListView#onPopulate() removes
all children of ListView and re-creates them.
So, the children of ListView that are present during Page#onRender() are
not the same children that were present during
IFormSubmitListener#onFormSubmitted(), and hence not the same children
that had the feedback messages.
Cheers,
Jesse
On 03/07/2013 02:35, James Selvakumar wrote:
No.
On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier <[email protected]> wrote:
Are you using listView.setReuseItems(true) ?
Sven
On 07/02/2013 11:13 AM, James Selvakumar wrote:
Hi all,
I've the following component heirarchy:
form:textField
form:listView:panel-1:**panel1DropDownChoice
form:submitButton
I've marked the all the form components as required.
I also have a behavior that is added to all the form components (via
IVisitor) which will make the respective feedback messages appear under
the
form components.
It works perfectly for the form component "texField" which is directly
attached to the form.
However it doesn't work for for "panel1DropDownChoice".
I've added some debug messages in the "validate()" method of
"panel1DropDownChoice" and found that feedback messages are indeed
generated.
However from the debug messages in my behavior, I found that feedback
messages were some how lost.
This is the behavior I'm using. (Thanks London Wicket users)
*public class ValidationMsgBehavior extends Behavior
{
private static Logger logger =
LoggerFactory.getLogger(**ValidationMsgBehavior.class);
@Override
public void afterRender(Component c)
{
logger.debug("Preparing to add validation msg for the component
{}", c);
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
String error;
if (fc.hasFeedbackMessage()) {
logger.debug("Form component {} has feedback messages",
fc);
error =
fc.getFeedbackMessages().**first(FeedbackMessage.ERROR).**
getMessage().toString();
} else {
error = "Your input is invalid.";
}
fc.getResponse().write(
"<div class=\"text-error\">" + error + "</div>");
}else{
logger.debug("Form component {} is valid", fc);
}
}
}*
Any clues? I've been trying to crack this for a whole day.
------------------------------**------------------------------**---------
To unsubscribe, e-mail:
users-unsubscribe@wicket.**apache.org<[email protected]>
For additional commands, e-mail: [email protected]