[Zope] form confirmation
Bo M. Maryniuck
b.maryniuk@forbis.lt
Tue, 30 Jul 2002 11:48:48 +0200
On Tuesday 30 July 2002 11:16, Stephan Goeldi wrote:
> >e.g. <FORM ACTION=3D"doStuff" METHOD=3D"POST" onSubmit=3D"confirm('Do =
you
> >*really* want to do that?')">
> >If the user hits "OK", the form will be submitted. If they hit "Cancel=
",
> >the browser will not submit the form.
>
> Hmmm. This is fine. But the document gets deleted anyway.
> It happens in DocumentLibrary's document_edit method.
> Anyway, thank you very much for this simple solution.
That example is _very_ simple. This should be like (untested):
<script language=3D"JavaScript1.2" type=3D"text/javascript">
<!--
if ((navigator.appName =3D=3D "Konqueror" && navigator.appVersion.cha=
rAt(0) >=3D 5) ||=20
(navigator.appName =3D=3D "Netscape" && navigator.appVersion.charA=
t(0) >=3D 4) ||=20
(navigator.appName =3D=3D "Microsoft Internet Explorer" && navigat=
or.appVersion.charAt(0) >=3D 4) ||=20
(navigator.appName =3D=3D "Opera" && navigator.appVersion.charAt(0=
) >=3D 4) ||=20
(navigator.appName =3D=3D "WebTV Plus Receiver" && navigator.appVe=
rsion.charAt(0) >=3D 3)) {
document.write("<FORM ACTION=3D\"doStuff\" METHOD=3D\"POST\" on=
Submit=3D\"delConfirm()\">");
}
else { document.write("<FORM ACTION=3D\"doStuffViaConfirm\" METHOD=3D=
\"POST\" "); }
//-->
</script>
This example will work if JS is turned on.=20
There is "doStuff" which deletes in anyway. There are "doStuffViaConfirm"=
which do via HTML-based=20
confirm. Then you just determine if user want JS or not. Actually you sho=
uld write the <FORM> tag
with "doStuffViaConfirm" and then if user wants JS ("right" browser for y=
our purposes) and JS is=20
turned on in preferenses -- just delete this form and rewrite it again wi=
th JavaScript stuff. In other
word -- that what I call "JavaScript masturbations". In other hand, if yo=
u like to make disaster to users,
who does not like or use JS -- just do this example above. ;-)
P.S. Do You still love JavaScr...
Segmentation fault. Core dumped
--=20
Sincerely yours, Bogdan M. Maryniuck
What's this script do?
unzip ; touch ; finger ; mount ; gasp ; yes ; umount ; sleep
Hint for the answer: not everything is computer-oriented. Sometimes you'r=
e
in a sleeping bag, camping out.
(Contributed by Frans van der Zande.)