Re: conditional form validators (nested forms issue)
Check out this: http://cwiki.apache.org/WICKET/conditional-validation.html We frequently override the isRequired method of individual fields on a form so that they are only required in the event that a specific button was clicked, or a specific class of button. For instance, you could tag your submit buttons with IRequireFields, and then just check in the isRequired method of each formcomponent. e.g.: TextField txt = new TextField(txtfield, model) { public boolean isRequired() { return findParent(Form.class).getRootForm().findSubmittingButton() instanceof IRequireFields; } } Leszek Gawron wrote: No no .. This is exactly the opposite of what I want. I cannot setDefaultFormProcessing to false for Wizard buttons - some screens may need other settings. I need the nested form validators NOT to fire when pressing wizard navigation buttons. Juan Carlos Garcia M. wrote: Set Button#setDefaultFormProcessing(false) Also check: http://cwiki.apache.org/WICKET/multiple-submit-buttons.html multiple-submit-buttons Leszek Gawron-2 wrote: Hello, say i have a small form : * first name - text field required * last name - text field required * phone no - text field required * submit button to add new contact everything works fine until I put the form into a wizard step. It turns out that wizard itself is a form. So now we have : wizard - some refreshing view - add contact form * first name - text field required * last name - text field required * phone no - text field required * submit button to add new contact - wizard navigation buttons Pressing wizard Next button makes addContactForm validate which raises required text fields errors. You cannot leave the step. Is there a way to fire form/field validators only if a specific button has been pressed? lg -- Leszek Gawron - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Leszek Gawron http://www.mobilebox.pl/krs.html CTO at MobileBox Ltd. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/%22conditional%22-form-validators-%28nested-forms-issue%29-tp23651166p23673085.html Sent from the Wicket - User 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: date format with datepicker
Look at this constructor in the javadocs: http://people.apache.org/~tobrien/wicket/apidocs/org/apache/wicket/extensions/markup/html/form/DateTextField.html DateTextField(java.lang.String id, IModel model, java.lang.String datePattern) the pattern is SimpleDateFormat, e.g. something like: org.apache.wicket.extensions.markup.html.form.DateTextField(auditEndDate, MM/dd/).add(new org.apache.wicket.extensions.yui.calendar.DatePicker())); (assuming you want month/day/year and not day/month/year, in which case it would be dd/MM/) fachhoch wrote: I have a date field add(new org.apache.wicket.extensions.markup.html.form.DateTextField(auditEndDate).add(new org.apache.wicket.extensions.yui.calendar.DatePicker())); this date picker puts the selected date in the format 1/1/01 can I configure this to format date as 1/1/2001 ? When user selectes a date the date which appears in datetextfiled should be of format 1/1/2001 , please tell me how can i do this ? -- View this message in context: http://www.nabble.com/date-format-with-datepicker-tp23676299p23676644.html Sent from the Wicket - User 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: Weird DatePicker / DateTextField off by one hour
I'm using 1.4 RC2. It was a daylight savings time issue... but one in my IDE's JRE rather than in Wicket. I patched it up and things are behaving as expected now. Thanks for the additional info about the timezone issue. -- View this message in context: http://www.nabble.com/Weird-DatePicker---DateTextField-off-by-one-hour-tp23304596p23369989.html Sent from the Wicket - User 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: Reversing checkbox behavior or negating a property model expression
Well I got an Overridden PropertyModel to give me the behavior I want, but it seems kind of dangerous. Hoping there's a better way to accomplish this. public class NegativePropertyModel extends PropertyModel { public NegativePropertyModel(final Object modelObject, final String expression) { super(modelObject, expression); } @Override public Object getObject() { if(super.getObject() != null) { return !((Boolean)super.getObject()).booleanValue(); } return null; } @Override public void setObject(Object o) { if(o instanceof Boolean) { super.setObject(o); } } } -- View this message in context: http://www.nabble.com/Reversing-checkbox-behavior-or-negating-a-property-model-expression-tp23218428p23218913.html Sent from the Wicket - User 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: Reversing checkbox behavior or negating a property model expression
Much thanks... works like a charm. igor.vaynberg wrote: class InverseBooleanModel implements imodelboolean private final imodelboolean delegate; public inversebooleanmodel(imodelbooleandelegate) { this.delegate=delegate; } public boolean getobject() { return !delegate; } public void setobject(boolean o) { delegate.setobject(!o); } public void detach() { delegate.detach(); } } add(new checkbox(cb, new inversebooleanmodel(model))); -igor On Fri, Apr 24, 2009 at 8:11 AM, Ryan LaHue ryanlahue...@gmail.com wrote: I'm scratching my head trying to figure out the best way to reverse the behavior of a checkbox, i.e. display an unchecked box when the model behind is true, and a checked box when the model behind is false. I don't want to negate all my domain objects' getters/setters to accomodate this. I was going to override the CheckBox.getConverter class to point to an extension of CheckBoxConverter with an overridden convertToObject method and simply reverse the: if (on.equals(value) || true.equals(value)) { return Boolean.TRUE; } else { return Boolean.FALSE; } Unfortunately the CheckBox.getConverter method is marked final, so this is not a possibility. I could override the onComponentTag method but I do not think it would be a good idea since there is a lot going on in there. Alternatively if there was a simple way to negate the value of the setter/getter in a PropertyModel I think that would do the trick, i.e. new CheckBox(checkbox, new PropertyModel(domainObject, !blue)); Any suggestions? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Reversing-checkbox-behavior-or-negating-a-property-model-expression-tp23218428p23223605.html Sent from the Wicket - User 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: Retrieving/serializing the javascript for an AjaxLink
Figured it out Basically no need to use AjaxLink since I have to construct the javascript redirect manually. I ended up doing this: chart.setOnClick(window.location=' + RequestCycle.get().urlFor(new CarPage(make, model, year)) + '); mallet wrote: I am trying to embed javascript links in some JSON which I pass to Open Flash Chart. I am able to test this by giving the on-click attribute of a chart element the value of alert('testing') and it pops up the alert as I expect. Now I need to create links to a Wicket page. All the links will go to the same page but I need to have different parameters depending on which element of my chart was clicked. I tried something like this but got null for the markup stream: AjaxLink lateLink = new AjaxLink (late) { public void onClick(AjaxRequestTarget target) { setResponsePage(new CarPage(make, model, year)); return; } }; chart.setOnClick(lateLink.getMarkupStream()); How can I go about building a dynamic javascript link to a wicket page which I can pass into the flash object? The chart object is just a bean which I run through a converter to seralizize its attributes to JSON. Thanks for any help. -- View this message in context: http://www.nabble.com/Retrieving-serializing-the-javascript-for-an-AjaxLink-tp23047799p23048696.html Sent from the Wicket - User 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: ResourceReferences not working as expected
Thanks for the responses. Jeremy: That's really strange... when I put the ResourceReference inside the image constructor it did work for the png image. I still not having any luck getting my javascript and .swf files to load, but I will continue trying. Igor: I made sure the IDE is copying all my filetypes into the classes folder, so that doesn't seem to be the problem in this case. I will update this topic if I figure out what I'm doing wrong. Jeremy Thomerson-5 wrote: Have you tried using it in an img tag rather than println? I.e.: add(new Image(img, ref)); -- Jeremy Thomerson http://www.wickettraining.com On Mon, Apr 13, 2009 at 11:38 AM, Ryan LaHue ryanlahue...@gmail.com wrote: I'm having trouble getting ResourceReferences to work for some reason, and was hoping somebody could give me some pointers. I'm using wicket 1.4. As a simple test I added a new page and put a test.png image in the same directory in my project. My structure is like so: project |--src |mypkg |--test |TestResource.java |test.png |--public_html |images |--test.png Java class: mypkg.test.TestResource.java ... ResourceReference ref = new ResourceReference(TestResource.class, test.png); System.out.println(Valid resource: + (ref.getResource() != null)); ... This always returns false. I also tried putting the test.png in my public_html/images directory but no luck. I don't seem to have any luck getting these Resources to load correctly, so I've had to resort to hardcoding my javascript references into my html files. Anybody have any suggestions? I've verified that all the files are being copied to my output classes folder. -- View this message in context: http://www.nabble.com/ResourceReferences-not-working-as-expected-tp23024914p23026294.html Sent from the Wicket - User 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: ResourceReferences not working as expected
Igor, you were right after all. There was an IDE exclusion on of my script's dependent files so it was not being copied over, causing my script to crash and appear not to be working. I thought I had verified they were all making it over but I missed one. Sincerest apologies for taking up your time. Thanks for your generous help once again. igor.vaynberg wrote: make sure whatever ide/tools you use copies non java resources into the compiled classpath. -igor On Mon, Apr 13, 2009 at 9:38 AM, Ryan LaHue ryanlahue...@gmail.com wrote: I'm having trouble getting ResourceReferences to work for some reason, and was hoping somebody could give me some pointers. I'm using wicket 1.4. As a simple test I added a new page and put a test.png image in the same directory in my project. My structure is like so: project |--src |mypkg |--test |TestResource.java |test.png |--public_html |images |--test.png Java class: mypkg.test.TestResource.java ... ResourceReference ref = new ResourceReference(TestResource.class, test.png); System.out.println(Valid resource: + (ref.getResource() != null)); ... This always returns false. I also tried putting the test.png in my public_html/images directory but no luck. I don't seem to have any luck getting these Resources to load correctly, so I've had to resort to hardcoding my javascript references into my html files. Anybody have any suggestions? I've verified that all the files are being copied to my output classes folder. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/ResourceReferences-not-working-as-expected-tp23024914p23026833.html Sent from the Wicket - User 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
[SOLVED] TreeTable header div automatically resizes its width infinitely large
Before I finished posting this question I figured out the solution to my problem, but because it was tricky to figure out I thought I would post this anyway in case somebody else runs into the same issue. == I created an editable treetable using the example at http://www.wicket-library.com/wicket-examples/ajax/ as a guide. The treetable displays fine, but there is a weird problem: several times a second the header div increments its width by a few pixels, causing the entire treetable to grow wider. Within a couple seconds the treetable causes a horizontal scroll bar to appear and if I leave my computer on the screen for a few minutes it is soon many thousands of pixels across and growing. I thought I must have made some mistake so I went and copied the example code from the example verbatim into my project and yet I have the same problem. I am using Wicket 1.4 RC2. SOLUTION: Turns out the way my page's CSS was set up was causing the problem. I have a #content wrapper div around all my pages. I had a width: 100%; attribute on this div. By simply removing this attribute from the wrapper div, the treetable quit resizing wider. I'm guessing either this attribute was inherited and the div thought it should be able to resize to 100% of 100%, with no fixed max pixel width, or something similar. -- View this message in context: http://www.nabble.com/-SOLVED--TreeTable-header-div-automatically-resizes-its-width-infinitely-large-tp22731126p22731126.html Sent from the Wicket - User 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
Migration from servlet to filter always serves WebApplication.getHomePage() when I click on links
Hello, I am using 1.3 and a servlet for Wicket in my web.xml, which I've pasted below. I am trying to change to using a Filter instead, which I also pasted below, but I get a weird behavior -- my WebApp.getHomePage() is served every time I click on a link. The links work fine when I use the servlet, and I followed the migration guide ( http://cwiki.apache.org/WICKET/migrate-13.html#Migrate-1.3-FilterinsteadofaServlet ), so I am not sure why I am getting this behavior. Any ideas? --- !-- This works -- servlet servlet-nameMyWebApp/servlet-name servlet-classorg.apache.wicket.protocol.http.WicketServlet/servlet-class init-param param-nameapplicationClassName/param-name param-valuemy.WebApp/param-value /init-param load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameMyWebApp/servlet-name url-pattern/app/*/url-pattern /servlet-mapping --- !-- This does not work -- filter filter-nameMyWebApp/filter-name filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class init-param param-nameapplicationClassName/param-name param-valuemy.WebApp/param-value /init-param /filter filter-mapping filter-nameMyWebApp/filter-name url-pattern/app/*/url-pattern /filter-mapping -- View this message in context: http://www.nabble.com/Migration-from-servlet-to-filter-always-serves-WebApplication.getHomePage%28%29-when-I-click-on-links-tp22298026p22298026.html Sent from the Wicket - User 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: Migration from servlet to filter always serves WebApplication.getHomePage() when I click on links
Thanks for the quick response Igor. I'm running OC4J... I changed the mapping as you suggested but am now getting a 403/Directory browsing not allowed. Once I find a way to coerce oc4j into allowing directory browsing I will post an update -- having some trouble getting my orion-web.xml changes to take, but this is not a wicket issue. igor.vaynberg wrote: try with /* mapping and see if it works you are not running this on websphere are you? -igor On Mon, Mar 2, 2009 at 2:12 PM, mallet ryanlahue...@gmail.com wrote: Hello, I am using 1.3 and a servlet for Wicket in my web.xml, which I've pasted below. I am trying to change to using a Filter instead, which I also pasted below, but I get a weird behavior -- my WebApp.getHomePage() is served every time I click on a link. The links work fine when I use the servlet, and I followed the migration guide ( http://cwiki.apache.org/WICKET/migrate-13.html#Migrate-1.3-FilterinsteadofaServlet ), so I am not sure why I am getting this behavior. Any ideas? --- !-- This works -- servlet servlet-nameMyWebApp/servlet-name servlet-classorg.apache.wicket.protocol.http.WicketServlet/servlet-class init-param param-nameapplicationClassName/param-name param-valuemy.WebApp/param-value /init-param load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameMyWebApp/servlet-name url-pattern/app/*/url-pattern /servlet-mapping --- !-- This does not work -- filter filter-nameMyWebApp/filter-name filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class init-param param-nameapplicationClassName/param-name param-valuemy.WebApp/param-value /init-param /filter filter-mapping filter-nameMyWebApp/filter-name url-pattern/app/*/url-pattern /filter-mapping -- View this message in context: http://www.nabble.com/Migration-from-servlet-to-filter-always-serves-WebApplication.getHomePage%28%29-when-I-click-on-links-tp22298026p22298026.html Sent from the Wicket - User 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Migration-from-servlet-to-filter-always-serves-WebApplication.getHomePage%28%29-when-I-click-on-links-tp22298026p22299235.html Sent from the Wicket - User 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
Using AjaxLink onClick method to retrieve and alter components
Hello, I have been trying for some time to figure this out but no luck. Some other posts suggest using a submit rather than an AjaxLink, but that will not work for me. Here is my scenario: I have two ListChoice objects on my page, one with several items in it and the other blank. I have an AjaxLink button that is visible only when the user selects one item from the populated ListChoice. When the user clicks an item and the AjaxLink becomes visible, I want them to be able to click on the AjaxLink and have the item removed from one ListChoice and inserted as an option in the second ListChoice. However, I am not having any luck in the onClick, method of the AjaxLink when I try to retrieve the selected item from the original ListChoice. In fact, I am not able to access any items on my page I do not want to submit my page or do a post, I simply want to have the AjaxLink's onClick do all the work. Is this possible? If so, how can I retrieve the selected option of a ListChoice called selectBox from within the onClick in my AjaxLink? Every time I attempt to retrieve and cast the ListChoice object I get a null value. -- View this message in context: http://www.nabble.com/Using-AjaxLink-onClick-method-to-retrieve-and-alter-components-tp22165850p22165850.html Sent from the Wicket - User 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: Using AjaxLink onClick method to retrieve and alter components
Thanks, Jeremy... very helpful. I didn't quite understand how the AjaxSubmitLink worked, but on your suggestion I refactored my code and found it to be exactly what I was looking for. Jeremy Thomerson-5 wrote: If you're using the AjaxLink - it is doing a round trip to the server. The problem is, the round trip does not include the form values - because it was a link - not a form submission. So, you have two options: 1 - don't use an ajax link - just use a webmarkupcontainer as your a tag and add the onclick yourself, using javascript like you would on a plain html page 2 - use an ajaxsubmitlink and do the processing server side I'd use #2. Why didn't you want to submit the form? The user won't be able to tell the form was submitted - especially if you skip validation by setDefaultFormProcessing(false) on your ajaxsubmitlink -- Jeremy Thomerson http://www.wickettraining.com On Mon, Feb 23, 2009 at 11:17 AM, mallet ryanlahue...@gmail.com wrote: Hello, I have been trying for some time to figure this out but no luck. Some other posts suggest using a submit rather than an AjaxLink, but that will not work for me. Here is my scenario: I have two ListChoice objects on my page, one with several items in it and the other blank. I have an AjaxLink button that is visible only when the user selects one item from the populated ListChoice. When the user clicks an item and the AjaxLink becomes visible, I want them to be able to click on the AjaxLink and have the item removed from one ListChoice and inserted as an option in the second ListChoice. However, I am not having any luck in the onClick, method of the AjaxLink when I try to retrieve the selected item from the original ListChoice. In fact, I am not able to access any items on my page I do not want to submit my page or do a post, I simply want to have the AjaxLink's onClick do all the work. Is this possible? If so, how can I retrieve the selected option of a ListChoice called selectBox from within the onClick in my AjaxLink? Every time I attempt to retrieve and cast the ListChoice object I get a null value. -- View this message in context: http://www.nabble.com/Using-AjaxLink-onClick-method-to-retrieve-and-alter-components-tp22165850p22165850.html Sent from the Wicket - User 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 -- View this message in context: http://www.nabble.com/Using-AjaxLink-onClick-method-to-retrieve-and-alter-components-tp22165850p22171907.html Sent from the Wicket - User 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
How do I remove duplicate FeedbackMessages from a FeedbackPanel?
I have a page that does the same validations to multiple fields. I would like only one error message to display There were one or more errors found when validating fields. Here's what I did: FeedbackPanel feedback = new FeedbackPanel(feedback, new IFeedbackMessageFilter() { public boolean accept(FeedbackMessage feedbackMessage) { //ProductionTrackingSheetPage.this.getFeedbackMessage() if(Session.get().getFeedbackMessages().messages(null).contains(feedbackMessage)) { System.out.println(Already have message: + feedbackMessage); return false; } return false; } }); The problem is that when I load the page and there are two errors, it displays none. Both times the System.out.print says it already has that message. It seems like the error message was added to the FeedbackPanel before it checked whether or not the accept function was run. Am I missing something simple? Is there another way I should be removing filtering out duplicates? -- View this message in context: http://www.nabble.com/How-do-I-remove-duplicate-FeedbackMessages-from-a-FeedbackPanel--tp20274678p20274678.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I remove duplicate FeedbackMessages from a FeedbackPanel?
Perhaps my post was premature... it seems there is in fact a getFeedbackMessages method in FeedbackPanel, but for some reason my IDE does not see it. I'm guessing these FeedbackMessages are put in the Session first, and then separately put on the panel, so the accept method is being run after they're already in the Session and will always return true as a result. -- View this message in context: http://www.nabble.com/How-do-I-remove-duplicate-FeedbackMessages-from-a-FeedbackPanel--tp20274678p20274793.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key
Solution: Igor's solution worked. I just had to make one small fix in my java code for my modal. The problem was that the DOM contained no element with id = okButton. A co-worker of mine pointed out that the id I assign to my submit input in the HTML template is being overwritten by Wicket when I created my AjaxButton. As a result, I had to add this: okButton.setMarkupId(okButton); Then using document.getelementbyid('okButton').onclick() worked. Everything is working great now and I appreciate the responses. Here is the final code for my PasswordTextField: PasswordTextField passwordTextField = new PasswordTextField(password, new ModelString()); passwordTextField.add(new AjaxFormComponentUpdatingBehavior(redirectEnterButton) { @Override public void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put(onkeypress, if (wicketKeyCode(event) == 13) { document.getElementById('okButton').onclick();return false;};); tag.put(onkeydown, if (wicketKeyCode(event) == 13) { return false; ); tag.put(onkeyup, if (wicketKeyCode(event) == 13) { return false;};); tag.put(onchange, if (wicketKeyCode(event) == 13) { return false;};); tag.put(onchangeoriginal, if (wicketKeyCode(event) == 13) { return false;};); } @Override protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) { //Required to override this function } }); mallet wrote: I tried as you suggested, but it gives me the 404 error in IE again. The browser bar in the 404 window has these parameters in it, after I typed asdfasdf and hit enter: ?pnList%3A0%3Aorders%3A0%3ApasswordModal%3Acontent%3Aform%3Apassword=asdfasdf I can put an alert('hi') in place of document.getelementbyid('okButton').onclick(), and it alerts me. Or I can simply do return false; and the enter button will be deactivated. But for some reason I am not able to access the okButton's onclick function like this... or maybe I am accessing it, but the problem is in there. I'll try some other things and get back if I find a solution. igor.vaynberg wrote: if (wicketKeyCode(event) == 13) { document.getelementbyid('myajaxbuttonsid').onclick(); } -igor On Wed, Oct 29, 2008 at 2:34 PM, mallet [EMAIL PROTECTED] wrote: Igor, Thanks for your reply. Here's what I did: PasswordTextField passwordTextField = new PasswordTextField(password, new ModelString()); passwordTextField.add(new AjaxFormComponentUpdatingBehavior(onkeydown) { @Override public void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put(onkeydown, if (wicketKeyCode(event) == 13) { return false;}; ); } }); However, the problem I have now is that the enter key no longer submits the form through my AjaxButton's onSubmit function. It simply disables the enter key from doing anything. This is better than before, but the users of this want to use the enter key to submit the form rather than the mouse click. I wonder if there is any way I can have it propagate the enter key to call the same function as when I press the AjaxButton with my mouse? igor.vaynberg wrote: easiest thing is to simply disable the enter key on the textfield by override onkeydown -igor On Wed, Oct 29, 2008 at 1:04 PM, mallet [EMAIL PROTECTED] wrote: I have a ModalWindow containing a class extending Panel. On the Panel I have a class extending Form. The Form contains a custom AjaxButton which overrides protected void onSubmit(AjaxRequestTarget target, Form? form). When I click this button it retrieves text from a PasswordField and validates it. It displays an error message on my Panel's FeedbackPanel in the event of en error; otherwise it closes the ModalWindow and refreshes the calling page. This works flawlessly when I use the mouse button to click my AjaxButton. It also works in FireFox3 when I use the enter button. But in IE7 when I use the enter button instead of the mouse, it gives me a 404 error in my browser and the modal window disappears without running the onSubmit function. Any suggestions on how to make this work for IE7? I would like to use a ModalWindow if at all possible instead of popping up another page. Here is my HTML: html xmlns:wicket=http://wicket.sourceforge.net/; lang=EN-US wicket:panel form wicket:id=form action= table width=75% cellpadding=5 cellspacing=0 border=0 align=center tr td colspan=2 div class=formFeedback wicket:id=feedback/div Password: input type=password wicket:id=password name=Password/input /td /tr tr td align=center input type=submit wicket:id=okButton value=Delete/ /td td # Cancel /td /tr /table /form /wicket:panel /html
IE7 ignores AjaxButton onSubmit when I use the keyboard enter key
I have a ModalWindow containing a class extending Panel. On the Panel I have a class extending Form. The Form contains a custom AjaxButton which overrides protected void onSubmit(AjaxRequestTarget target, Form? form). When I click this button it retrieves text from a PasswordField and validates it. It displays an error message on my Panel's FeedbackPanel in the event of en error; otherwise it closes the ModalWindow and refreshes the calling page. This works flawlessly when I use the mouse button to click my AjaxButton. It also works in FireFox3 when I use the enter button. But in IE7 when I use the enter button instead of the mouse, it gives me a 404 error in my browser and the modal window disappears without running the onSubmit function. Any suggestions on how to make this work for IE7? I would like to use a ModalWindow if at all possible instead of popping up another page. Here is my HTML: html xmlns:wicket=http://wicket.sourceforge.net/; lang=EN-US wicket:panel form wicket:id=form action= table width=75% cellpadding=5 cellspacing=0 border=0 align=center tr td colspan=2 div class=formFeedback wicket:id=feedback/div Password: input type=password wicket:id=password name=Password/input /td /tr tr td align=center input type=submit wicket:id=okButton value=Delete/ /td td # Cancel /td /tr /table /form /wicket:panel /html - Here is my AjaxButton which I add to my Form object. add(new AjaxButton(okButton, this) { @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { if(form.get(password) != null (PasswordTextField)form.get(password) != null) { String userEnteredPassword = ((PasswordTextField)form.get(password)).getInput(); if(userEnteredPassword != null !userEnteredPassword.equals() validPassword(userEnteredPassword)) { //Delete successful; closing window window.close(target); return; } } error(Invalid password); } - Thanks. -- View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20234862.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key
FYI, I did try some of the suggestions in here but to no avail: http://www.nabble.com/Form-Enter-Key-Problem-td14408121.html Also I have investigated using some custom JavaScript manipulate IE, but I would like to avoid a messy solution like that if possible. -- View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20234941.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key
Igor, Thanks for your reply. Here's what I did: PasswordTextField passwordTextField = new PasswordTextField(password, new ModelString()); passwordTextField.add(new AjaxFormComponentUpdatingBehavior(onkeydown) { @Override public void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put(onkeydown, if (wicketKeyCode(event) == 13) { return false;}; ); } }); However, the problem I have now is that the enter key no longer submits the form through my AjaxButton's onSubmit function. It simply disables the enter key from doing anything. This is better than before, but the users of this want to use the enter key to submit the form rather than the mouse click. I wonder if there is any way I can have it propagate the enter key to call the same function as when I press the AjaxButton with my mouse? igor.vaynberg wrote: easiest thing is to simply disable the enter key on the textfield by override onkeydown -igor On Wed, Oct 29, 2008 at 1:04 PM, mallet [EMAIL PROTECTED] wrote: I have a ModalWindow containing a class extending Panel. On the Panel I have a class extending Form. The Form contains a custom AjaxButton which overrides protected void onSubmit(AjaxRequestTarget target, Form? form). When I click this button it retrieves text from a PasswordField and validates it. It displays an error message on my Panel's FeedbackPanel in the event of en error; otherwise it closes the ModalWindow and refreshes the calling page. This works flawlessly when I use the mouse button to click my AjaxButton. It also works in FireFox3 when I use the enter button. But in IE7 when I use the enter button instead of the mouse, it gives me a 404 error in my browser and the modal window disappears without running the onSubmit function. Any suggestions on how to make this work for IE7? I would like to use a ModalWindow if at all possible instead of popping up another page. Here is my HTML: html xmlns:wicket=http://wicket.sourceforge.net/; lang=EN-US wicket:panel form wicket:id=form action= table width=75% cellpadding=5 cellspacing=0 border=0 align=center tr td colspan=2 div class=formFeedback wicket:id=feedback/div Password: input type=password wicket:id=password name=Password/input /td /tr tr td align=center input type=submit wicket:id=okButton value=Delete/ /td td # Cancel /td /tr /table /form /wicket:panel /html - Here is my AjaxButton which I add to my Form object. add(new AjaxButton(okButton, this) { @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { if(form.get(password) != null (PasswordTextField)form.get(password) != null) { String userEnteredPassword = ((PasswordTextField)form.get(password)).getInput(); if(userEnteredPassword != null !userEnteredPassword.equals() validPassword(userEnteredPassword)) { //Delete successful; closing window window.close(target); return; } } error(Invalid password); } - Thanks. -- View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20234862.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20236367.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key
I tried as you suggested, but it gives me the 404 error in IE again. The browser bar in the 404 window has these parameters in it, after I typed asdfasdf and hit enter: ?pnList%3A0%3Aorders%3A0%3ApasswordModal%3Acontent%3Aform%3Apassword=asdfasdf I can put an alert('hi') in place of document.getelementbyid('okButton').onclick(), and it alerts me. Or I can simply do return false; and the enter button will be deactivated. But for some reason I am not able to access the okButton's onclick function like this... or maybe I am accessing it, but the problem is in there. I'll try some other things and get back if I find a solution. igor.vaynberg wrote: if (wicketKeyCode(event) == 13) { document.getelementbyid('myajaxbuttonsid').onclick(); } -igor On Wed, Oct 29, 2008 at 2:34 PM, mallet [EMAIL PROTECTED] wrote: Igor, Thanks for your reply. Here's what I did: PasswordTextField passwordTextField = new PasswordTextField(password, new ModelString()); passwordTextField.add(new AjaxFormComponentUpdatingBehavior(onkeydown) { @Override public void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put(onkeydown, if (wicketKeyCode(event) == 13) { return false;}; ); } }); However, the problem I have now is that the enter key no longer submits the form through my AjaxButton's onSubmit function. It simply disables the enter key from doing anything. This is better than before, but the users of this want to use the enter key to submit the form rather than the mouse click. I wonder if there is any way I can have it propagate the enter key to call the same function as when I press the AjaxButton with my mouse? igor.vaynberg wrote: easiest thing is to simply disable the enter key on the textfield by override onkeydown -igor On Wed, Oct 29, 2008 at 1:04 PM, mallet [EMAIL PROTECTED] wrote: I have a ModalWindow containing a class extending Panel. On the Panel I have a class extending Form. The Form contains a custom AjaxButton which overrides protected void onSubmit(AjaxRequestTarget target, Form? form). When I click this button it retrieves text from a PasswordField and validates it. It displays an error message on my Panel's FeedbackPanel in the event of en error; otherwise it closes the ModalWindow and refreshes the calling page. This works flawlessly when I use the mouse button to click my AjaxButton. It also works in FireFox3 when I use the enter button. But in IE7 when I use the enter button instead of the mouse, it gives me a 404 error in my browser and the modal window disappears without running the onSubmit function. Any suggestions on how to make this work for IE7? I would like to use a ModalWindow if at all possible instead of popping up another page. Here is my HTML: html xmlns:wicket=http://wicket.sourceforge.net/; lang=EN-US wicket:panel form wicket:id=form action= table width=75% cellpadding=5 cellspacing=0 border=0 align=center tr td colspan=2 div class=formFeedback wicket:id=feedback/div Password: input type=password wicket:id=password name=Password/input /td /tr tr td align=center input type=submit wicket:id=okButton value=Delete/ /td td # Cancel /td /tr /table /form /wicket:panel /html - Here is my AjaxButton which I add to my Form object. add(new AjaxButton(okButton, this) { @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { if(form.get(password) != null (PasswordTextField)form.get(password) != null) { String userEnteredPassword = ((PasswordTextField)form.get(password)).getInput(); if(userEnteredPassword != null !userEnteredPassword.equals() validPassword(userEnteredPassword)) { //Delete successful; closing window window.close(target); return; } } error(Invalid password); } - Thanks. -- View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20234862.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20236367.html Sent from the Wicket - User mailing list archive at Nabble.com