[thelist] javascript confirm dual submit nastiness

Jeff Howden jeff at jeffhowden.com
Sat Nov 23 23:30:01 CST 2002


> From: Anne-Marie
> Why don't you try this, it works in CF, no reason it
> shouldn't work with php. Just replace #QueryName.Field#
> by the php notation and the action by your file name.
> <!--- Delete button --->
> 	<INPUT TYPE="Button" VALUE="Delete"
>      onClick='if(confirm("Are you sure you would
>      like to delete: #QueryName.Field#?")) {
>      this.form.action="file_delete.cfm";
>      this.form.submit();}'>

no offense, but that's a horrible solution.  just because you can change the
value of the action attribute of the <form> tag doesn't mean you should.
similarly, just because you can submit the form with the submit() method
doesn't mean you should either -- though the former is by far the worst
transgression of the two.  the former makes the delete functionality
completely inaccessible to non-js users.  the latter leads to other
inaccessible behaviors.

there honestly is *no* reason for your solution.  there are plenty of
accessible ways to solve this problem.

do yourself and the users of your applications a favor and give the
following two articles a read.

Links & JavaScript Living Together in Harmony

Forms & JavaScript Living Together in Harmony



jeff at members.evolt.org

More information about the thelist mailing list