- see footer for list info -<
Hi Paul,
A better/easier way to do it would be to not use javascript and instead
submit to a confirmation page i.e. "Are you sure you want to delete...".
Problem with javascript is if the user's system has it switched off,
then they can delete by accident and get angry.
This is true of all form validation. If you need to adhere to WAI
(especially if you're working in government which I seem to remember you
do) then you shouldn't rely on javascript to report
validation/confirmation, it breaks Priority 1 checkpoint 6.3:
"And if you use applets and scripts (Priority 1)
* 6.3
<http://www.w3.org/TR/WAI-WEBCONTENT/wai-pageauth.html#tech-scripts> Ensure
that pages are usable when scripts, applets, or other programmatic
objects are turned off or not supported. If this is not possible,
provide equivalent information on an alternative accessible page.
"
HTH
Damian
Stephen Moretti wrote:
- see footer for list info -<
Couple of things to get you started....
Give you buttons real names instead of clickme - call them what they
are eg. btnModifyVictim, btnDeleteVictim etc....
Different browsers react differently with a submit button, but with
most you will find that the contents of onSubmit takes priority over
onClick and once your form is submitted the onClick event never
happens. So you either need to change all your buttons except the one
from type="submit" to type="button" or you need to change your
onSubmit function to handle all the buttons.
Get your actions off of the onClick events and into functions - if you
need to use content of CF variables in the actions, then set them in
the function call eg.
instead of :
onClick="this.form.action='ModifyData.cfm?rpt=1&ElementToGet=#ElementToGet#&record=#RecordToGet#';"
have :
onClick="doModifyData(#ElementToGet#,#RecordToGet#)"
and in your function set hidden inputs to these values rather than
pegging them on the url.
Hope that helps get you started
Stephen
On 28/06/06, Paul Swingewood <[EMAIL PROTECTED]> wrote:
>- see footer for list info -<
Can anyone help me with this please ....?
I have a form with several buttons on it. One of the button is delete. I
want to give a "Are you sure popup" and then direct to the page that
does
the delete .... I have this
<script language="JavaScript">
<!--
function submitForm()
{
document.IncidentForm.clickme.value = "Please Wait...";
document.IncidentForm.clickme.disabled = "disabled";
return true;
}
function confirm_entry()
{
input_box=confirm("Are you sure you want to delete
this victim?");
if (input_box==true)
{
// submit the form to the delete page
this.form.action='ModifyDelete.cfm?ID=#recordtoget#';
}
else
{
// Output when Cancel is clicked
alert ("You clicked cancel");
}
}
//-->
</script>
The form is like this ......
<form name="IncidentForm" action="WriteData.cfm" method="post"
onSubmit="submitForm();">
Blah blah blah ....
and then the submits are like this ....
<tr>
<td align="left">
<input type="submit" name="clickme3"
value="Add another victim"
onClick="this.form.action='WriteData.cfm?rpt=1';">
</td>
<cfif #NumberOfVictims# GT 1>
<td align="center">
<cfoutput>
<input type="submit" name="clickme4"
value="Delete this victim"
onclick="confirm_entry();">
</cfoutput>
</td>
</cfif>
<!--- If there are no more records in the
list then don't show the next
victim button --->
<cfif URL.ElementToGet LT
ListLen(VictimIdList)>
<td align="right">
<!--- if there are then
increment the elementtoget --->
<cfset ElementToGet =
URL.ElementToGet + 1>
<cfoutput>
<input type="submit"
name="clickme1" value="Next victim"
onClick="this.form.action='ModifyData.cfm?rpt=1&ElementToGet=#ElementToGet#&record=#RecordToGet#';">
</cfoutput>
</td>
</cfif>
<td align="right">
<cfoutput>
<input type="submit" name="clickme2"
value="Next"
onClick="this.form.action='ModifyData.cfm?record=#RecordToGet#';">
</cfoutput>
</td>
</tr>
When the user clicks ok the page goes to writedata instead of
modifydelete
.....
What am I doing wrong?
Regards - Paul
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go
to http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your
help -<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go
to http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your
help -<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<