Re: Feedback panel not displaying
Could you do a quickstart ? François > Le 29 oct. 2018 à 18:42, SeldonCrisis a écrit : > > Okay, I'm calling form.error() now instead. Unfortunately it didn't solve my > issue :( > > On the first click this was printed: > 00af SystemOut O ERROR LandingPage_Cp10 Does the form have > error:true > > So it recognizes that there is indeed an error, but it's not bring the > feedback panel along in the ajax response. Only after the second click the > ajax-response has all the correct feedback code. > > > > -- > Sent from: > http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Feedback panel not displaying
Okay, I'm calling form.error() now instead. Unfortunately it didn't solve my issue :( On the first click this was printed: 00af SystemOut O ERROR LandingPage_Cp10 Does the form have error:true So it recognizes that there is indeed an error, but it's not bring the feedback panel along in the ajax response. Only after the second click the ajax-response has all the correct feedback code. -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Feedback panel not displaying
also when you call error(), you call it on your component, not on the form. you should call it like this : private boolean activeSessionExist(Form form){ OCPSession session = (OCPSession)WebSession.get(); if(session.getTrackingId() != null){ log.error("Active session found. Cannot have more than one OCP tracking number open at a time."); String error = "You have an active OCP Tracking Number open already. " + "This application only allows one active OCP Tracking Number. " + "Please use the \"Exit\" button to close that Tracking Number before starting a new " + getTypeCode(); form.error(error); return true; } return false; } François > Le 29 oct. 2018 à 16:57, SeldonCrisis a écrit : > > Oh strange, probably because I put the code in < raw > tags. Thanks for the > heads up. > > *OK, here's the button code:* > radioWmc1Step2.add(new AjaxButton("btnNewBegin") { > private static final long serialVersionUID = 1L; > @Override > public void onSubmit(AjaxRequestTarget target, Form form) { > if (activeSessionExist()){ > target.add(feedback); > log.debug("Does the form have error:" + > form.hasError()); > return; > } > logUserAction(ocpAuthorization.getEmailAddress(), "602", > "CP10", "OCP", > ocpAuthorization.getSecretTrackingNumber()); > onPageSubmit(target); > } > > @Override > protected void onError(AjaxRequestTarget target, Form form) { > onSaveFormBtnError(target); > target.add(radioWmc1Step2); > target.appendJavaScript("trackingNumberMask();"); > }; > } > > *And the code where I add to feedback panel* > private boolean activeSessionExist(){ > OCPSession session = (OCPSession)WebSession.get(); > > if(session.getTrackingId() != null){ > log.error("Active session found. Cannot have more than one OCP > tracking > number open at a time."); > String error = "You have an active OCP Tracking Number open > already. " > + "This application only allows one active OCP > Tracking Number. " > + "Please use the \"Exit\" button to close that > Tracking Number before > starting a new " + getTypeCode(); > > error(error); > return true; > } > return false; > } > > Thanks again > > -- > Sent from: > http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
Re: Feedback panel not displaying
works great for me. @Override protected void onInitialize() { super.onInitialize(); Form form = new Form("form"); add(form); FeedbackPanel feedback = new FeedbackPanel("feedback"); feedback.setOutputMarkupId(true); form.add(feedback); form.add(new AjaxButton("AjaxButton") { private static final long serialVersionUID = 1L; @Override public void onSubmit(AjaxRequestTarget target) { if (activeSessionExist()) { target.add(feedback); log.debug("Does the form have error:" + getForm().hasError()); } } }); } private boolean activeSessionExist() { error("You have an active OCP"); return true; } What is printed at the log.debug("Does the form have error:" + form.hasError()); at the first click ? François > Le 29 oct. 2018 à 16:57, SeldonCrisis a écrit : > > Oh strange, probably because I put the code in < raw > tags. Thanks for the > heads up. > > *OK, here's the button code:* > radioWmc1Step2.add(new AjaxButton("btnNewBegin") { > private static final long serialVersionUID = 1L; > @Override > public void onSubmit(AjaxRequestTarget target, Form form) { > if (activeSessionExist()){ > target.add(feedback); > log.debug("Does the form have error:" + > form.hasError()); > return; > } > logUserAction(ocpAuthorization.getEmailAddress(), "602", > "CP10", "OCP", > ocpAuthorization.getSecretTrackingNumber()); > onPageSubmit(target); > } > > @Override > protected void onError(AjaxRequestTarget target, Form form) { > onSaveFormBtnError(target); > target.add(radioWmc1Step2); > target.appendJavaScript("trackingNumberMask();"); > }; > } > > *And the code where I add to feedback panel* > private boolean activeSessionExist(){ > OCPSession session = (OCPSession)WebSession.get(); > > if(session.getTrackingId() != null){ > log.error("Active session found. Cannot have more than one OCP > tracking > number open at a time."); > String error = "You have an active OCP Tracking Number open > already. " > + "This application only allows one active OCP > Tracking Number. " > + "Please use the \"Exit\" button to close that > Tracking Number before > starting a new " + getTypeCode(); > > error(error); > return true; > } > return false; > } > > Thanks again > > -- > Sent from: > http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
Re: Feedback panel not displaying
Oh strange, probably because I put the code in < raw > tags. Thanks for the heads up. *OK, here's the button code:* radioWmc1Step2.add(new AjaxButton("btnNewBegin") { private static final long serialVersionUID = 1L; @Override public void onSubmit(AjaxRequestTarget target, Form form) { if (activeSessionExist()){ target.add(feedback); log.debug("Does the form have error:" + form.hasError()); return; } logUserAction(ocpAuthorization.getEmailAddress(), "602", "CP10", "OCP", ocpAuthorization.getSecretTrackingNumber()); onPageSubmit(target); } @Override protected void onError(AjaxRequestTarget target, Form form) { onSaveFormBtnError(target); target.add(radioWmc1Step2); target.appendJavaScript("trackingNumberMask();"); }; } *And the code where I add to feedback panel* private boolean activeSessionExist(){ OCPSession session = (OCPSession)WebSession.get(); if(session.getTrackingId() != null){ log.error("Active session found. Cannot have more than one OCP tracking number open at a time."); String error = "You have an active OCP Tracking Number open already. " + "This application only allows one active OCP Tracking Number. " + "Please use the \"Exit\" button to close that Tracking Number before starting a new " + getTypeCode(); error(error); return true; } return false; } Thanks again -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Feedback panel not displaying
Hi, Can’t see your code in your message. François > Le 29 oct. 2018 à 15:40, SeldonCrisis a écrit : > > Hey guys, > > I have an AjaxButton() that is being added to a WebMarkupContainer. > > Within the onSubmit() of the button, I check to see whether there is already > an active session ID or not. If there is, I want to discontinue processing, > and display the feedback panel with an error message. > > This ALMOST works, but the feedback panel won't display until after I click > the button TWICE. > > So the FIRST time I click the button, it discontinues processing, the SECOND > time I click the button the feedback panel is added to the page. > > Here's the button code: > > > And here's the code where I'm adding the message to the feedback panel: > > > So the message is added to the feedback panel in activeSessionExist() and > then the feedback panel is added to the target in the onSubmit() of the > button. > > I wan't the feedback panel to be added to the page on the first click. Any > ideas as to whats going on? > > -- > Sent from: > http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Feedback panel not displaying
Hey guys, I have an AjaxButton() that is being added to a WebMarkupContainer. Within the onSubmit() of the button, I check to see whether there is already an active session ID or not. If there is, I want to discontinue processing, and display the feedback panel with an error message. This ALMOST works, but the feedback panel won't display until after I click the button TWICE. So the FIRST time I click the button, it discontinues processing, the SECOND time I click the button the feedback panel is added to the page. Here's the button code: And here's the code where I'm adding the message to the feedback panel: So the message is added to the feedback panel in activeSessionExist() and then the feedback panel is added to the target in the onSubmit() of the button. I wan't the feedback panel to be added to the page on the first click. Any ideas as to whats going on? -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org