[Zope] form confirmation

Quentin Smith quentins@comclub.dyndns.org
Mon, 29 Jul 2002 12:10:15 -0400


On Monday, July 29, 2002, at 03:53  AM, Chris Withers wrote:

> Stephan G=F6ldi wrote:
>> I want to let a user confirm the submit button, before it is really
>> submitted. What is the suggested way to let a dtml form be confirmed
>> before submit?
>> Something like
>> "file will be changed, are you sure? (Y/N)"
>
> Something Javascript-y?

Hi-
Find the <FORM> tag in your code.
e.g. <FORM ACTION=3D"doStuff" METHOD=3D"POST">
Add an onSubmit handler.
e.g. <FORM ACTION=3D"doStuff" METHOD=3D"POST" onSubmit=3D"confirm('Do =
you=20
*really* want to do that?')">
If the user hits "OK", the form will be submitted. If they hit "Cancel",=20=

the browser will not submit the form. Keep in mind that if the user=20
isn't using a JavaScript-compatible browser, they won't see anything.
HTH,
--Quentin

> cheers,
>
> Chris