You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2017/07/28 20:12:21 UTC
AjaxButton not calling onError after required validation fail
We have an AjaxButton, some fields are failing required check, but the
onError of the button is not being invoked. This means we can't add the
container to the target, and therefore the ComponentFeedbackPanel is not
rendering with the message.
radioWmc2Step1.add(new AjaxButton("btnResSend", form)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
log.debug("btnResSend");
logUserAction(ocpAuthorization.getEmailAddress(), "601", "CP10", "OCP",
"Send PIN");
onSendPin();
radioWmc2Step1.setVisible(false);
radioWmc2Step2.setVisible(true);
target.add(radioWmc2Step1);
target.add(radioWmc2Step2);
}
@Override
protected void onError(AjaxRequestTarget target, Form form) {
//does not fire on required message
target.add(radioWmc2Step1);
};
}
.setOutputMarkupId(true)
.setOutputMarkupPlaceholderTag(true)
);
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-not-calling-onError-after-required-validation-fail-tp4678346.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxButton not calling onError after required validation fail
Posted by Entropy <bl...@gmail.com>.
When the world doesn't make sense, it's amazing how often it turns out to be
some simple little mistake we overlook. This was all a cut & paste error in
my co-worker's code. He was binding the ComponentFeedbackPanels to the
wrong text fields, but the names were close enough to the correct names that
a casual inspection by every pair of eyes that tried to help him missed the
difference.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-not-calling-onError-after-required-validation-fail-tp4678346p4678393.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxButton not calling onError after required validation fail
Posted by Martin Grigorov <mg...@apache.org>.
Set a breakpoint at FeedbackMessage#markRendered() and see when this
happens.
It seems something marks the feedback message as rendered before it being
rendered.
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Mon, Jul 31, 2017 at 9:57 PM, Entropy <bl...@gmail.com> wrote:
> Okay, new info. So, alot of what I said I accepted on faith from a
> co-worker
> who was working the problem. I'm posting on his behalf. Turns out some of
> that was wrong, but we do have a little bit of a poser here nonetheless. I
> apologize for that. I should make my guys all sign up for this forum
> rather
> than using me as a go between.
>
> First, the button.onError(target, form) is invoked. However, the
> ComponentFeedbackPanel is not rendering. We have a custom behavior that
> writes an error css class onto the control if isValid() is false, and that
> is working. In debug, I can see the hasFeedbackMessage()==true, and the
> getFeedbackMessages() returns an error with the right field name on it.
> Yes
> the component feedback does not render.
>
> I put setOutputMarkupId(true) on literally everything, and
> setOutputPlaceholderTag(true) on the component feedbacks. That didn't
> help.
> I explicitly added each feedback to the target rather than their parent.
>
> Yet the ComponentFeedbackPanel doesn't show the errors. I looked in F12
> tools and saw that the span for it actually IS there, there's just nothing
> in it.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxButton-not-calling-onError-after-
> required-validation-fail-tp4678346p4678384.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: AjaxButton not calling onError after required validation fail
Posted by Entropy <bl...@gmail.com>.
Okay, new info. So, alot of what I said I accepted on faith from a co-worker
who was working the problem. I'm posting on his behalf. Turns out some of
that was wrong, but we do have a little bit of a poser here nonetheless. I
apologize for that. I should make my guys all sign up for this forum rather
than using me as a go between.
First, the button.onError(target, form) is invoked. However, the
ComponentFeedbackPanel is not rendering. We have a custom behavior that
writes an error css class onto the control if isValid() is false, and that
is working. In debug, I can see the hasFeedbackMessage()==true, and the
getFeedbackMessages() returns an error with the right field name on it. Yes
the component feedback does not render.
I put setOutputMarkupId(true) on literally everything, and
setOutputPlaceholderTag(true) on the component feedbacks. That didn't help.
I explicitly added each feedback to the target rather than their parent.
Yet the ComponentFeedbackPanel doesn't show the errors. I looked in F12
tools and saw that the span for it actually IS there, there's just nothing
in it.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-not-calling-onError-after-required-validation-fail-tp4678346p4678384.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxButton not calling onError after required validation fail
Posted by Martin Grigorov <mg...@apache.org>.
I guess Wicket thinks that some of the other buttons is clicked instead.
Attach the debugger and see what happens.
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Mon, Jul 31, 2017 at 3:39 PM, Entropy <bl...@gmail.com> wrote:
> Wicket 6.24
>
> Yes, there are other buttons. Somehow, they seem to work under the same
> conditions. We compared and don't see why they behave differently. There
> are alternate panels that show/hide based on choices further up the form,
> and that dictates which buttons and fields are shown.
>
> Yes, form.onError() seems to be called. But with no ajax target, how can I
> add the right feedback panel components to the target?
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxButton-not-calling-onError-after-
> required-validation-fail-tp4678346p4678362.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: AjaxButton not calling onError after required validation fail
Posted by Entropy <bl...@gmail.com>.
Wicket 6.24
Yes, there are other buttons. Somehow, they seem to work under the same
conditions. We compared and don't see why they behave differently. There
are alternate panels that show/hide based on choices further up the form,
and that dictates which buttons and fields are shown.
Yes, form.onError() seems to be called. But with no ajax target, how can I
add the right feedback panel components to the target?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-not-calling-onError-after-required-validation-fail-tp4678346p4678362.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxButton not calling onError after required validation fail
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
The provided information is not enough to help you.
Which version of Wicket do you use ?
Do you have other buttons in this form ?
Is Form#onError() called ?
Put a breakpoint in Form#onFormSubmitted() and follow to see where it goes.
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Fri, Jul 28, 2017 at 11:12 PM, Entropy <bl...@gmail.com> wrote:
> We have an AjaxButton, some fields are failing required check, but the
> onError of the button is not being invoked. This means we can't add the
> container to the target, and therefore the ComponentFeedbackPanel is not
> rendering with the message.
>
> radioWmc2Step1.add(new AjaxButton("btnResSend", form)
> {
> @Override
> protected void onSubmit(AjaxRequestTarget target,
> Form form) {
> log.debug("btnResSend");
> logUserAction(ocpAuthorization.getEmailAddress(),
> "601", "CP10", "OCP",
> "Send PIN");
> onSendPin();
> radioWmc2Step1.setVisible(false);
> radioWmc2Step2.setVisible(true);
>
> target.add(radioWmc2Step1);
> target.add(radioWmc2Step2);
> }
>
> @Override
> protected void onError(AjaxRequestTarget target,
> Form form) {
> //does not fire on required message
> target.add(radioWmc2Step1);
> };
> }
> .setOutputMarkupId(true)
> .setOutputMarkupPlaceholderTag(true)
> );
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxButton-not-calling-onError-after-
> required-validation-fail-tp4678346.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>