Re: jQuery reference with context relative path
Thank you again, it's working ! Dav -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jQuery-reference-with-context-relative-path-tp4661155p4661180.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
jQuery reference with context relative path
Hi, I am using wicket 6.8.0. I need to use a custom jquery reference. My custom js file is in my webapp/scripts/lib folder. I cannot figure out how to create a ResourceReference base on a url like HeaderItem. *Application.init:* getJavaScriptLibrarySettings().setJQueryReference(SwtuJqueryResourceReference.get()); *HeaderItem base on a url:* JavaScriptHeaderItem.forUrl(scripts/libs/jquery-1.8.3/jquery-1.8.3.custom.min.js); If I use a UrlResourceReference, every time my page is accessed with an optional parameter, my reference to my js file don't work. Thanks Dav -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jQuery-reference-with-context-relative-path-tp4661155.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form submit without redirection
Yeah it would be much easier that way. We have ajax for every actions in our form but when we want to change page, we use the full submit. I could do the same thing with an abstract behavior. I will give it a try. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-submit-without-redirection-tp4659496p4659598.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form submit without redirection
Hi thanks for your response. The errors that I want to send back are my form business error. I use jQuery validate to do my frontend validation and to display them. We build a custom plugin to display the business errors the same way the frontend errors are displayed. So basically, I send back a list of business errors to a javascript template that will merge these errors to the jQuery validation plugin. (each errors are recorded to a specific field). I know I should not pass page parameters but this is how the they manage to do it in wicket 1.4.2 and there were not passed in the URL (get)... So I will do a little refactoring.. Where should I keep my error list to send to the same page ? Session or Metadata or else ? thanks David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-submit-without-redirection-tp4659496p4659547.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Form submit without redirection
Hi, I migrated my application from wicket 1.4.21 to 6.8.0. In the onSubmit method of a SubmitLink, if errors are present in the submitted values, I want to display the same page with the specified errors. In wicket 1.4, I was doing this : public void handleErrors() { if (!this.errors.isEmpty()) { // Pass the errors to the resulting page final PageParameters params = new PageParameters(); params.put(errors, this.errors); // Do not redirect! getRequestCycle().setRedirect(false); // Same page is shown with validation errors setResponsePage(getClass(), params); } } The errors were passed to the response in post parameters. Now, with wicket 6.8.0 (think this appears since wicket 5...), the only difference in my code is that the method getRequestCycle().setRedirect(false) disappear. Now, all my errors are sent in the URL because of the redirect after the post. Is there a way that I can turn off the redirection only if errors are present ? I don't want to see all my errors in the URL. Thanks David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-submit-without-redirection-tp4659496.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form submit without redirection
Or is there a way I can add extra post parameters to my request ? I don't want to put my errors in my session (too much management). I would like to add my errors to my request only for the current request (request scope) Is there a way I can achieve this ? Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-submit-without-redirection-tp4659496p4659509.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice AjaxFormChoiceComponentUpdatingBehavior and validation
Thanks Sven, I had not tested the setEventPropagation(BUBBLE), only the setAllowDefault(true). It's working perfectly right now ! @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { attributes.setAllowDefault(true); attributes.setEventPropagation(EventPropagation.BUBBLE); super.updateAjaxAttributes(attributes); } Thanks David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-AjaxFormChoiceComponentUpdatingBehavior-and-validation-tp4659216p4659426.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice AjaxFormChoiceComponentUpdatingBehavior and validation
Thank you for your response. By overriding the updateAjaxAttributes and adding attributes.setAllowDefault(true), my javascript validation works but my behavior (ajax call) is not triggered. @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { attributes.setAllowDefault(true); } If I call the super class updateAjaxAttributes and I add the setAllowDefault(true) method, it wont change anything. My field stay in error after the ajax call @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setAllowDefault(true); } David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-AjaxFormChoiceComponentUpdatingBehavior-and-validation-tp4659216p4659227.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice AjaxFormChoiceComponentUpdatingBehavior and validation
The ajax response are the same if I compare with a Wicket 6.6.0 application version. Looks like the AjaxFormChoiceComponentUpdatingBehavior is blocking the jQuery Validation to unhighlight my field before the ajax call is triggered. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-AjaxFormChoiceComponentUpdatingBehavior-and-validation-tp4659216p4659228.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice AjaxFormChoiceComponentUpdatingBehavior and validation
The problem is really related with the onClick event. I copied the class AjaxFormChoiceComponentUpdatingBehavior in my project (hijacking) and changed the event click by onchange. The validation and the ajax call are working perfectly. Jquery validation bind a click event on my radioChoice. Adding a AjaxFormChoiceComponentUpdatingBehavior on my RadioChoice will unbind or just don't execute my jQuery validation click event. Result, even when my radio is checked, my field stays in error. Is this a bug ? I know there was problem when adding multiple wicket behavior on a field (only the last one added was executed) but in my case, I only have 1 wicket behavior. All other events are added by Jquery validation. Any idea ? Thanks David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-AjaxFormChoiceComponentUpdatingBehavior-and-validation-tp4659216p4659229.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AbstractDefaultAjaxBehavior complete handler
You could override the getSuccessScript() method. Return the javascript code or method to be executed. David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AbstractDefaultAjaxBehavior-complete-handler-tp4659230p4659232.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AbstractDefaultAjaxBehavior complete handler
I am using wicket 6.6.0 and these behaviors: AjaxFormComponentUpdatingBehavior AjaxFormSubmitBehavior. In both case, I am overriding the getPreconditionScript() and getSuccessScript() method to display and hide a please wait gif around each ajax call. @Override protected CharSequence getSuccessScript() { return $.swtu.event.postAjaxHook();; } When I just want to display a dialog box for example after an Ajax call (onChange behavior), I override the onUpdate or onEvent method and used the target.appendJavaScript(...) method. @Override protected void onUpdate(AjaxRequestTarget target) { target.appendJavaScript(); } Hope this helps. David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AbstractDefaultAjaxBehavior-complete-handler-tp4659230p4659234.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RadioChoice AjaxFormChoiceComponentUpdatingBehavior and validation
Hi, Im not sure if my problem is related to wicket or jQuery but since I upgraded from wicket 6.6.0 to 6.8.0, my required validation on RadioChoice is not working anymore. The problems occurs on every RadioChoice with an AjaxFormChoiceComponentUpdatingBehavior behavior. If I removed the behavior, my validation works perfectly. When the behavior is on my radioChoice, my ajax listener is called but my field stays in error. I didn't change anycode. I just upgraded from 6.6.0 to 6.8.0. I am using jQuery Validation Plugin 1.11.1 for validation. Do we still need to use AjaxFormChoiceComponentUpdatingBehavior on RadioChoice ? Does anyone encounter a similar problem ? Thanks David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-AjaxFormChoiceComponentUpdatingBehavior-and-validation-tp4659216.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
getPrefixToContextPath and optional named parameters
Hi, I am migrating from wicket 1.4.21 to wicket 6.6.0. In a javascript template, I need to get the path of an image. In wicket 1.4.21, I used to do : values.put(datePickerImageUrl, String.format(%simages/icn-calendar.png, RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot())); In wicket 6.6.6, I use: values.put(datePickerImageUrl,String.format(%simages/icn-calendar.png, RequestCycle.get().getRequest() .getPrefixToContextPath())); My page is mount like so: mountPage(dwelling/#{lang}, DwellingPage.class); My page and my image path works great except when I access the page with the optional parameter. I that case, getPrefixToContextPath does not return the correct prefix. I should get ../images/icn-calendar.png. because the url is /dwelling/en but instead I get images/icn-calendar.png Is this a bug ? Is there an other method I could use ? Thanks David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/getPrefixToContextPath-and-optional-named-parameters-tp4657934.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: getPrefixToContextPath and optional named parameters
Great it's working ! I did not know this util class. A huge thank you ! I was writing my own getPrefixToContextPath method base on the request url ! Thanks again ! David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/getPrefixToContextPath-and-optional-named-parameters-tp4657934p4657945.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Browser Cookie detection
In wicket 1.4.21, I was using the RedirectException class. Cookies were transfered. public HomePage(final PageParameters parameters) { super(parameters); if (MySession.session().isSessionSetup()) { Cookie requestCookie = ((WebRequest) getRequest()).getCookie(appCoookie); if (requestCookie == null) { // Cookies are not enabled. } // Working with wicket 1.4.21 } Cookie appCookie = new Cookie(appCoookie, 1); appCookie.setMaxAge(3600 * 5); appCookie.setPath(/); appCookie.setSecure(false); ((WebResponse) getResponse()).addCookie(appCookie); if (!MySession.session().isSessionSetup()) { MySession.session().setIsSessionSetup(true); throw new RedirectException(HomePage.class); } } Is there a similar exception that I could use in wicket 6.6.0 to do the same work (add the cookie to the response and then check it in the request) ? Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744p4657822.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Browser Cookie detection
thanks it's working ! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744p4657826.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Browser Cookie detection
Does NonResettingRestartException suppose to keep the cookies in the response ? I am using wicket 6.6.0 on jboss 6 and when I throw a NonResettingRestartException, the cookies are not present in the request after. Cookie appCookie = new Cookie(appCoookie, 1); ((WebResponse) getResponse()).addCookie(appCookie); // Redirection needed for client cookies detection. throw new NonResettingRestartException(AppWebSession.session().getNavigationManager().getEntryPoint() .getNodeClass(), this.pageParameters); . In the same page constructor the first thing i check is the presence of the cookie: Cookie requestCookie = ((WebRequest) getRequest()).getCookie(appCoookie); System.out.println(--- + (requestCookie != null)); // Always false. Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744p4657772.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Browser Cookie detection
Sorry this was just a test cookie. Even with the age, Cookie appCookie = new Cookie(appCoookie, 1); appCookie.setMaxAge(3600 * 5); appCookie.setPath(/); appCookie.setSecure(false); the cookie is not transfer. When i debug, in the transferResponseMetaData of the NonResettingRestartException class, the originalResponse and the response are the same so the meta data are not written. WebResponse originalResponse = (WebResponse) cycle.getOriginalResponse(); if (originalResponse != response) { IMetaDataBufferingWebResponse bufferingWebResponse = (IMetaDataBufferingWebResponse) response; bufferingWebResponse.writeMetaData(originalResponse); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744p4657780.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Browser Cookie detection
I just created a new wicket 6.6.0 quickstart project (http://wicket.apache.org/start/quickstart.html) and I have the same problem. If I add the following code in the HomePage class, Cookie requestCookie = ((WebRequest) getRequest()).getCookie(appCoookie); System.out.println(--- + (requestCookie != null)); Cookie appCookie = new Cookie(appCoookie, 1); appCookie.setMaxAge(3600 * 5); appCookie.setPath(/); appCookie.setSecure(false); ((WebResponse) getResponse()).addCookie(appCookie); if (getSession().getAttribute(init) == null) { getSession().setAttribute(init, true); System.out.println(here...); throw new NonResettingRestartException(HomePage.class); } the second time I enter the HomePage constructor, the cookie is not present in the request. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744p4657789.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Browser Cookie detection
Hi I just migrated to wicket 6.6.0 and I need display a page to the customer when his browser cookies are disabled. Is there a better approach to do this ? Is it better to - add a cookie to the response and redirect to the same page and then check the presence of the cookie in the request Or - use session().getClientInfo().getProperties().isCookiesEnabled() provided method. Thanks. David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Browser Cookie detection
Thanks for your answer ! If I check the presence of the cookies in Javascript, how would you redirect the client to the cookie disabled page ? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744p4657749.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Browser Cookie detection
Thanks for your help I will consider this option ! David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744p4657753.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxEventBehavior called twice because of javascript onchange
My mistake, I works great with the nullvalid. I just realize that if I have an onchange behavior and a javascript (jQuery) onchange function bind on the same dropdown, with IE, calling the javascript onchange function will also call the wicket onchange behavior. Can't figure out why. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxEventBehavior-called-twice-because-of-javascript-onchange-tp4656329p4656413.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AjaxEventBehavior called twice because of javascript onchange
Hi, I using wicket 1.4.21 and developing an application that needs to work in IE7 and +., firefox, chrome etc. I have a problem with IE. Ajax listener are called twice because I have javascript that remove the dropdown default empty option Choose One. My ajax listener is called on first time and then the javascript is removing the default option causing my Ajax listener being called again. This problems occurs only in IE. This is not really related to wicket but I was wondering if anyone had this problems before. ** My clients want the Choose One option so I can't just put a default value to the drop down. Thanks for help. David Java code Javacript code : -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxEventBehavior-called-twice-because-of-javascript-onchange-tp4656329.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
IE DropDown onChange behavior not triggered on first time
Hi, I have a strange behavior on dropdowns with Internet Explorer and wicket onchange behavior. I have a basic DropDownChoice with a basic onchange AjaxFormComponentUpdatingBehavior. The first time I enter the page, the onchange event will not be triggered on first click. To make the onchange trigger, I need to select a value in the drop down and click anywhere else on the page. This behavior occurs only on the first page access. I found a work around by adding an hidden ajax link in the page and binding the onchange event via jQuery. I was just wondering if anyone else had this problem ? Thanks Dav -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/IE-DropDown-onChange-behavior-not-triggered-on-first-time-tp4656237.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: IE DropDown onChange behavior not triggered on first time
Sorry, i am using wicket 1.4.21. My onchange behavior does not change the value. My behavior only prepend javascript only for a specific value. I am not changing the value programatically. On first page acces, if I select any option in the drowndown, the onchange event will not be trigger except if I click anywhere else on the page. If I come back in the same page, the same scenario will work without clicking anywhere else in the page. Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/IE-DropDown-onChange-behavior-not-triggered-on-first-time-tp4656237p4656241.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Ad dynamic javascript to a component
Hi, I would like to add javascript inside a panel. The problem is that I need to get server informations inside the javascript. I know we can an abstract behavior and add the javascript in the header by overriding the renderHead method but i don't want my script in the head. I would like my javascrit render under inside my panel. When the visiblity of the panel will change, the javascript will be executed. body wicket:panel noscript /noscript /wicket:panel /body Thanks for help -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Ad-dynamic-javascript-to-a-component-tp4655947.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: urls with localization
Hi, Do you think it's possible to replace the url language part /en/ , /fr/ by other english or french url ? Instead of having /fr/home /en/home could we have /frenchCompanyName/home /englishCompanyName/home I changed the LocaleUrlCodingStrategyDecorator class to do so but I have lots of non related errors.. Thanks for your help. Dav -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/urls-with-localization-tp1890817p4655435.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Layout Design
Thanks Jesse for your reply. The only drawback of this method is that I will need to override theses 3 methods (createNewHeader, createNewFooter...) in all pages that extends BasePage.java.Ideally I would like to avoid copying code but I think it's the cleaner way to override layout components. Thanks again ! David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Layout-Design-tp4650630p4650734.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket Layout Design
Hi, I am new to Wicket. I'm working on a multi province web application. The goal is to use the same web application for all provinces. CSS and some business logic will differ for each province. I want to know the best ways to instantiate my layout components in my base page. (Using markup inheritance for page composition) * Each layout component could be subclassed. public class BasePage extends WebPage { public BasePage() { // Want to know the best way to instanciate // HeaderXXX or HeaderYYY for example base on the province. add(new Header()); add(new SideBar()); add(new Footer()); } } My BasePage is in a common maven module. Each province subclassed pages and components are in a different maven module. I read that using factories to instanciate components was not a good idea (http://blog.comsysto.com/2011/05/09/apache-wicket-best-practices-2/) Do you have a better approach to accomplish this? Thanks a lot and sorry for my english David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Layout-Design-tp4650630.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org