Re: Re[2]: Are you sure?
Hi Dima, list, [Dima wrote] we tried to use this (form.onsumbit="return f()") but encountered a problem: if JavaScript is disabled in browser the submiting goes on without confirmation dialogue and other stuff done by JS (wich in our case was more important). We solved this by setting input.type="button" instead of "submit" and submitting the form from JacaScript. But this caused another problem (though less important): now user can not submit form pressing "Enter" being at text input, he must click the button. [end of quote] Personally, I would not consider this as a problem. I noticed that quite some users mistakenly press the Enter key, without yet wanting to submit. So I tried your sollution, and it works fine, making the html:submit into a html:button, which calls a javascript function which calls submit. But since the official submit button has now disappeared, pressing enter results in the next button being processed by default, which is the cancel button (which I would not want either). So by implementing this, I cannot use < anymore. What would be the best sollution for that? I thought of putting a javascript function "goCancel()" under a <, which does this: document.myform.action="somenextpage.do"; document.myform.submit(); However I wonder if there are any smarter sollutions. Is there for example some way to set IsCancelled to true from the jsp, so I can just use the same actions as i do with submit? thanks, Rinke Tuesday, March 23, 2004, 11:43:54 AM, you wrote: JS> Try with this - JS> < name="dateForm" JS> type="nl.rinke.DateForm" JS> onsubmit="return areyousure()" > JS> Should work JS> -Original Message- JS> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] JS> Sent: Tuesday, March 23, 2004 3:10 PM JS> To: [EMAIL PROTECTED] JS> Subject: "are you sure?" JS> Hi list, JS> Still a struts newbie, I try to write an "are you sure" javascript JS> confirmation box for my submit button. JS> The question is: how can I prevent the form from being submitted JS> when the user clicks "no"? JS> In the Jsp, I put the following code in the head: JS> < JS>function areyousure(){ JS> var agree = false; JS> agree = confirm("are you sure?"); JS> if(agree){ JS> ... some code which is not important JS> } JS> return agree; JS>} JS> < JS> And the form tag looks like this: JS> < name="dateForm" JS> type="nl.rinke.DateForm" JS> onsubmit="areyousure()" > JS> Whatever the user clicks, yes or no, the form JS> gets submitted. I want to stop submitting the JS> form when the user click "no". JS> thanks, Rinke JS> - JS> To unsubscribe, e-mail: struts-user- [EMAIL PROTECTED] JS> For additional commands, e-mail: [EMAIL PROTECTED] JS> - JS> To unsubscribe, e-mail: struts-user- [EMAIL PROTECTED] JS> For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Dmitriimailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: struts-user- [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] 0100,0100,0100--- End of forwarded message --- --- End of forwarded message --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Re[2]: "are you sure?"
submitting to the server returning an action message with a checkbox (check to confirm). and then resubmitting I reckon would be nicer than a javascript dependency. in the action something like .. boolean confirmed = theForm.getConfirmed().equals("true"); if(!confirmed) { ActionMessages messages= blas bla saveMessages(bla bla); } On 23 Mar 2004, at 13:29, Dmitrii CRETU wrote: AS> Wow, I'm confused. If javascript was disabled, the onSubmit trigger was AS> ignored, but the button onClick trigger was honored? I'll have to try that AS> out. If JavaScript is disabled neither of solutions work properly. But with "button" you avoid uncontrolled form submition, simply nothing happens. In "submit"-scenario the submition is taken place without JavaScript preprocessing (onSubmit event) wich could not be accepted sometimes, e.g. when you encrypt some fields. Dima. AS> Andreas AS> -Ursprungliche Nachricht- AS> Von: Dmitrii CRETU [mailto:[EMAIL PROTECTED] AS> Gesendet: Dienstag, 23. Marz 2004 11:09 AS> An: Struts Users Mailing List AS> Betreff: Re[2]: "are you sure?" AS> we tried to use this (form.onsumbit="return f()") but encountered a problem: AS> if JavaScript is disabled in browser the submiting goes on without AS> confirmation dialogue and other stuff done by JS (wich in our case was AS> more important). AS> We solved this by setting input.type="button" instead of "submit" and AS> submitting the form from JacaScript. But this caused another problem AS> (though less important): now user can not submit form pressing "Enter" AS> being at text input, he must click the button. AS> Dima. AS> Tuesday, March 23, 2004, 11:43:54 AM, you wrote: JS>> Try with this - JS>> > name="dateForm" JS>> type="nl.rinke.DateForm" JS>> onsubmit="return areyousure()" > JS>> Should work JS>> -Original Message- JS>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] JS>> Sent: Tuesday, March 23, 2004 3:10 PM JS>> To: [EMAIL PROTECTED] JS>> Subject: "are you sure?" JS>> Hi list, JS>> Still a struts newbie, I try to write an "are you sure" javascript JS>> confirmation box for my submit button. JS>> The question is: how can I prevent the form from being submitted JS>> when the user clicks "no"? JS>> In the Jsp, I put the following code in the head: JS>> JS>>function areyousure(){ JS>> var agree = false; JS>> agree = confirm("are you sure?"); JS>> if(agree){ JS>> ... some code which is not important JS>> } JS>> return agree; JS>>} JS>> JS>> And the form tag looks like this: JS>> > name="dateForm" JS>> type="nl.rinke.DateForm" JS>> onsubmit="areyousure()" > JS>> Whatever the user clicks, yes or no, the form JS>> gets submitted. I want to stop submitting the JS>> form when the user click "no". JS>> thanks, Rinke JS>> - JS>> To unsubscribe, e-mail: [EMAIL PROTECTED] JS>> For additional commands, e-mail: [EMAIL PROTECTED] JS>> - JS>> To unsubscribe, e-mail: [EMAIL PROTECTED] JS>> For additional commands, e-mail: [EMAIL PROTECTED] AS> -- AS> Best regards, AS> Dmitriimailto:[EMAIL PROTECTED] AS> - AS> To unsubscribe, e-mail: [EMAIL PROTECTED] AS> For additional commands, e-mail: [EMAIL PROTECTED] AS> - AS> To unsubscribe, e-mail: [EMAIL PROTECTED] AS> For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Dmitriimailto:[EMAIL PROTECTED] - 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]
Re: AW: Re[2]: "are you sure?"
AS> Wow, I'm confused. If javascript was disabled, the onSubmit trigger was AS> ignored, but the button onClick trigger was honored? I'll have to try that AS> out. If JavaScript is disabled neither of solutions work properly. But with "button" you avoid uncontrolled form submition, simply nothing happens. In "submit"-scenario the submition is taken place without JavaScript preprocessing (onSubmit event) wich could not be accepted sometimes, e.g. when you encrypt some fields. Dima. AS> Andreas AS> -Ursprungliche Nachricht- AS> Von: Dmitrii CRETU [mailto:[EMAIL PROTECTED] AS> Gesendet: Dienstag, 23. Marz 2004 11:09 AS> An: Struts Users Mailing List AS> Betreff: Re[2]: "are you sure?" AS> we tried to use this (form.onsumbit="return f()") but encountered a problem: AS> if JavaScript is disabled in browser the submiting goes on without AS> confirmation dialogue and other stuff done by JS (wich in our case was AS> more important). AS> We solved this by setting input.type="button" instead of "submit" and AS> submitting the form from JacaScript. But this caused another problem AS> (though less important): now user can not submit form pressing "Enter" AS> being at text input, he must click the button. AS> Dima. AS> Tuesday, March 23, 2004, 11:43:54 AM, you wrote: JS>> Try with this - JS>> > name="dateForm" JS>> type="nl.rinke.DateForm" JS>> onsubmit="return areyousure()" > JS>> Should work JS>> -Original Message- JS>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] JS>> Sent: Tuesday, March 23, 2004 3:10 PM JS>> To: [EMAIL PROTECTED] JS>> Subject: "are you sure?" JS>> Hi list, JS>> Still a struts newbie, I try to write an "are you sure" javascript JS>> confirmation box for my submit button. JS>> The question is: how can I prevent the form from being submitted JS>> when the user clicks "no"? JS>> In the Jsp, I put the following code in the head: JS>> JS>>function areyousure(){ JS>> var agree = false; JS>> agree = confirm("are you sure?"); JS>> if(agree){ JS>> ... some code which is not important JS>> } JS>> return agree; JS>>} JS>> JS>> And the form tag looks like this: JS>> > name="dateForm" JS>> type="nl.rinke.DateForm" JS>> onsubmit="areyousure()" > JS>> Whatever the user clicks, yes or no, the form JS>> gets submitted. I want to stop submitting the JS>> form when the user click "no". JS>> thanks, Rinke JS>> - JS>> To unsubscribe, e-mail: [EMAIL PROTECTED] JS>> For additional commands, e-mail: [EMAIL PROTECTED] JS>> - JS>> To unsubscribe, e-mail: [EMAIL PROTECTED] JS>> For additional commands, e-mail: [EMAIL PROTECTED] AS> -- AS> Best regards, AS> Dmitriimailto:[EMAIL PROTECTED] AS> - AS> To unsubscribe, e-mail: [EMAIL PROTECTED] AS> For additional commands, e-mail: [EMAIL PROTECTED] AS> - AS> To unsubscribe, e-mail: [EMAIL PROTECTED] AS> For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Dmitriimailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Re[2]: "are you sure?"
Wow, I'm confused. If javascript was disabled, the onSubmit trigger was ignored, but the button onClick trigger was honored? I'll have to try that out. Andreas -Ursprungliche Nachricht- Von: Dmitrii CRETU [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 23. Marz 2004 11:09 An: Struts Users Mailing List Betreff: Re[2]: "are you sure?" we tried to use this (form.onsumbit="return f()") but encountered a problem: if JavaScript is disabled in browser the submiting goes on without confirmation dialogue and other stuff done by JS (wich in our case was more important). We solved this by setting input.type="button" instead of "submit" and submitting the form from JacaScript. But this caused another problem (though less important): now user can not submit form pressing "Enter" being at text input, he must click the button. Dima. Tuesday, March 23, 2004, 11:43:54 AM, you wrote: JS> Try with this - JS>name="dateForm" JS> type="nl.rinke.DateForm" JS> onsubmit="return areyousure()" > JS> Should work JS> -Original Message- JS> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] JS> Sent: Tuesday, March 23, 2004 3:10 PM JS> To: [EMAIL PROTECTED] JS> Subject: "are you sure?" JS> Hi list, JS> Still a struts newbie, I try to write an "are you sure" javascript JS> confirmation box for my submit button. JS> The question is: how can I prevent the form from being submitted JS> when the user clicks "no"? JS> In the Jsp, I put the following code in the head: JS> JS>function areyousure(){ JS> var agree = false; JS> agree = confirm("are you sure?"); JS> if(agree){ JS> ... some code which is not important JS> } JS> return agree; JS>} JS> JS> And the form tag looks like this: JS>name="dateForm" JS> type="nl.rinke.DateForm" JS> onsubmit="areyousure()" > JS> Whatever the user clicks, yes or no, the form JS> gets submitted. I want to stop submitting the JS> form when the user click "no". JS> thanks, Rinke JS> - JS> To unsubscribe, e-mail: [EMAIL PROTECTED] JS> For additional commands, e-mail: [EMAIL PROTECTED] JS> - JS> To unsubscribe, e-mail: [EMAIL PROTECTED] JS> For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Dmitriimailto:[EMAIL PROTECTED] - 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]
Re[2]: "are you sure?"
we tried to use this (form.onsumbit="return f()") but encountered a problem: if JavaScript is disabled in browser the submiting goes on without confirmation dialogue and other stuff done by JS (wich in our case was more important). We solved this by setting input.type="button" instead of "submit" and submitting the form from JacaScript. But this caused another problem (though less important): now user can not submit form pressing "Enter" being at text input, he must click the button. Dima. Tuesday, March 23, 2004, 11:43:54 AM, you wrote: JS> Try with this - JS>name="dateForm" JS> type="nl.rinke.DateForm" JS> onsubmit="return areyousure()" > JS> Should work JS> -Original Message- JS> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] JS> Sent: Tuesday, March 23, 2004 3:10 PM JS> To: [EMAIL PROTECTED] JS> Subject: "are you sure?" JS> Hi list, JS> Still a struts newbie, I try to write an "are you sure" javascript JS> confirmation box for my submit button. JS> The question is: how can I prevent the form from being submitted JS> when the user clicks "no"? JS> In the Jsp, I put the following code in the head: JS> JS>function areyousure(){ JS> var agree = false; JS> agree = confirm("are you sure?"); JS> if(agree){ JS> ... some code which is not important JS> } JS> return agree; JS>} JS> JS> And the form tag looks like this: JS>name="dateForm" JS> type="nl.rinke.DateForm" JS> onsubmit="areyousure()" > JS> Whatever the user clicks, yes or no, the form JS> gets submitted. I want to stop submitting the JS> form when the user click "no". JS> thanks, Rinke JS> - JS> To unsubscribe, e-mail: [EMAIL PROTECTED] JS> For additional commands, e-mail: [EMAIL PROTECTED] JS> - JS> To unsubscribe, e-mail: [EMAIL PROTECTED] JS> For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Dmitriimailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]