RE: Confirmation dialog
The problem in your first example is return confirm('text'); Once you dismiss the confirm dialog, no matter which button you click, the javascript returns. Same with your second example. You hit a return statement before the Ajax script gets executed. Your third example works, because if you hit OK, the JS processing continues and executes the Ajax script. If you hit cancel, confirm() returns false, thus executing the return statement and skipping the Ajax script. (Assuming the variable 'test' is true, if 'test' is false, the confirm dialog shouldn't even appear at all and the Ajax script will get just get executed.) Hope that helps. Joel -Original Message- From: drf [mailto:davidrfi...@gmail.com] Sent: Wednesday, October 20, 2010 8:26 AM To: users@wicket.apache.org Subject: Re: Confirmation dialog Do not know what my mistake is in the previous example, but this works: return if (test) {if (!confirm('TEXT')) return false;} + script; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirmation-dialog-tp1844404p3003762.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: Confirmation dialog
I am having a problem when using IAjaxDecorator as described. In the predecorate method, I have: return if(test-variable) return confirm('text'); + script; The confirm button appears, but even on clicking 'OK', it looks as if false is getting returned every time, because the code in onClick(AjaxRequestTarget) is not getting called. Perhaps there is something wrong with my basic synatx, because normal processing does not continue even after the following: return if (1==1) {return true;} else {return true;} + script; Help is truly appreciated !!! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirmation-dialog-tp1844404p3003697.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: Confirmation dialog
Do not know what my mistake is in the previous example, but this works: return if (test) {if (!confirm('TEXT')) return false;} + script; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirmation-dialog-tp1844404p3003762.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: Confirmation Dialog Not Displayed For Button
I ran this in IE7, Firefox and Google Chrome and it worked fine. make sure you don't have a javascript error in the page and maybe add delete.add(new SimpleAttributeModifier( onclick, if (!confirm('Delete?') ){ return false; })); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirmation-Dialog-Not-Displayed-For-Button-tp2955022p2955033.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: Confirmation Dialog Not Displayed For Button
I am using FF 3.6.10 and there were no javascript errors. However, adding the if statement seemed to make the difference as it's now displaying. Thanks! -Original Message- From: Mathias Nilsson [mailto:wicket.program...@gmail.com] Sent: Monday, October 04, 2010 2:51 PM To: users@wicket.apache.org Subject: Re: Confirmation Dialog Not Displayed For Button I ran this in IE7, Firefox and Google Chrome and it worked fine. make sure you don't have a javascript error in the page and maybe add delete.add(new SimpleAttributeModifier( onclick, if (!confirm('Delete?') ){ return false; })); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirmation-Dialog-Not-Displ ayed-For-Button-tp2955022p2955033.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Confirmation dialog during file upload
I have a form which allows a user to upload a file. The form is patterned after upload Wicket example. If the file being uploaded will overwrite an existing file I need to prompt the user if they want to replace the existing file or not. What's the best way to implement this functionality? There is nothing special about it. Just display a confirmation page. Only if the user chooses to go ahead, will it save the file. Below is an example doing that written in Scala (as my exercise in learning Scala): class MyPage extends WebPage { val f = new Form[Unit](f) { override def onSubmit = { val exists = true if (exists) { setResponsePage(new ConfirmSavePage(upload.getFileUpload)) } else { Console.println(saving the file +upload.getFileUpload.getClientFileName) } } } add(f) val upload = new FileUploadField(upload) f.add(upload) } class ConfirmSavePage(upload: FileUpload) extends WebPage { val f = new Form[Unit](f) { override def onSubmit = { Console.println(saving the file +upload.getClientFileName) } } add(f) val cancel = new Button(cancel) { override def onSubmit = { Console.println(Aborting) setResponsePage(classOf[MyPage]) } } f.add(cancel) } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Confirmation dialog during file upload
Sorry, there is a bug in the code: You should never keep a FileUpload object across requests. So, you need to copy the data into somewhere else. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Confirmation dialog during file upload
Hello, If I understand your approach correctly, then the user would have to click Upload button again after being redirected MyPage to ConfirmSavePage, which is not desirable. I would like to implement the following interaction: 1. User clicks Upload button and form submission request is sent to the server 2. The code on the server detect the file name collision and causes a ModalWindow to display 3.1 If the user clicks Confirm button then upload form submission is resumed. 3.2 If the user clicks Cancel button then upload form submission is canceled. What's the best way to implement this interaction? Can I use a request intercepting page to display the ModalWindow? Thanks On Fri, Jun 18, 2010 at 3:42 AM, Kent Tong k...@cpttm.org.mo wrote: Sorry, there is a bug in the code: You should never keep a FileUpload object across requests. So, you need to copy the data into somewhere else. - 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: Confirmation dialog during file upload
1. User clicks Upload button and form submission request is sent to the server 2. The code on the server detect the file name collision and causes a ModalWindow to display These can be done with an AjaxButton to send the upload request. Then show the ModalWindow in onSubmit(). 3.1 If the user clicks Confirm button then upload form submission is resumed. The Confirm button would be another AjaxButton then. Just save the file in onSubmit(). Of course, make sure you copied the file content in the first place for use here. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Confirmation dialog
Similar: http://old.nabble.com/javascript-confirm---seems-to-work-fine-with-link-markup-but-not-with-button-markup-td27242553.html On Thu, Jan 28, 2010 at 5:00 PM, Josh Kamau joshnet2...@gmail.com wrote: Hi Team lnkDelete.add(new SimpleAttributeModifier(onClick,return confirm('Are you sure you want to Delete?') )); The above code produces a confirmation message if its a Link and doesnt work if its an AjaxFallbackLink. How do i make it work on ajax link regards. Josh -- Pedro Henrique Oliveira dos Santos
Re: Confirmation dialog
use an IAjaxCallDecorator dataContainer.add(new AjaxButton(removeSelectedValues) { @Override protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) { private static final long serialVersionUID = 1L; @Override public CharSequence preDecorateScript(CharSequence script) { return if(!confirm('Are you sure you want to delete the selected values? \\n\\nNOTE: This localized identifier will be deleted in ALL application bundles and there is NO UNDO')) return false; + script; } }; } On Jan 28, 2010, at 11:00 AM, Josh Kamau wrote: Hi Team lnkDelete.add(new SimpleAttributeModifier(onClick,return confirm('Are you sure you want to Delete?') )); The above code produces a confirmation message if its a Link and doesnt work if its an AjaxFallbackLink. How do i make it work on ajax link regards. Josh To our success! Mystic Coders, LLC | Code Magic | www.mysticcoders.com ANDREW LOMBARDI | and...@mysticcoders.com 2321 E 4th St. Ste C-128, Santa Ana CA 92705 ofc: 714-816-4488 fax: 714-782-6024 cell: 714-697-8046 linked-in: http://www.linkedin.com/in/andrewlombardi twitter: http://www.twitter.com/kinabalu Eco-Tip: Printing e-mails is usually a waste. This message is for the named person's use only. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient.