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>> <html:form action="/adddate" 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>> <SCRIPT LANGUAGE="javascript"> 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>> </SCRIPT> JS>> And the form tag looks like this: JS>> <html:form action="/adddate" 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> Dmitrii mailto:[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, Dmitrii mailto:[EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]