one potential solution is to call a function with your onSubmit event
triggers, instead of doing it inline.
define a function
myFunction () {
..
}
in your HEAD section, and call it
document.forms[0].onSubmit="myFunction();"
like that.
then you can modify the myFunction to your heart's content.
christopher olive, cto, vp of web development
cresco technologies, inc
410.825.0383
http://www.crescotech.com
-----Original Message-----
From: Duane Boudreau [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 19, 2001 1:05 AM
To: CF-Talk
Subject: JavaScript: onLoad and onSubmit
(Sorry if this doesn't make sense its 1am on the east coast)
I know this possible but I can not remember how this is done. In my code
below I have two problems,
1) I am over writing the onload event, which is a pain if anything else
has
already modified this event, or there is an onload event set.
2) I am over writing the onSubmit, which has the same problems as onLoad
I know it is possible to append to the onSubmit and onLoad functions but
I
cant seem to remember what the correct syntax is.
My code is structured like this (I've cut out several hundred lines of
code
but this should give you the idea):
<cfquery name="qryFormFields">
SELECT fieldtype, fieldlabel
FROM formfields
</cfquery>
<table>
<CFForm .... >
<cfloop query="qryFormFields">
<tr>
<td>#qryFormFields.fieldlabel#</td>
<td><cfmodule template="\tags\DisplayFormFeild.cfm"
fieldtype="#qryFormFields.fieldtype#"><td>
</tr>
</cfloop>
</CFForm>
<table>
---------------------
DisplayFormField.cfm
<cfswitch expression="#Attributes.FieldType#">
<cfcase value="M">
<textarea name="f1"></texatarea>
<script>
function f1() {
if (.....) {
alert("f1 invalid");
return false;
}
}
document.forms[0].onSubmit="return f1();"
</script>
</cfcase>
<cfcase value="T">
<cfinput type="text" name="f1">
</cfcase>
<cfcase value="I">
<input type="File" name="f1">
<script>
function f1() {
if (.....) {
alert("invalid image");
return false;
}
}
document.forms[0].onSubmit="return f1();"
</script>
</cfcase>
<cfcase value="W">
<cfmodule template="/tags/hexaedit.cfm" html="">
</cfcase>
</cfswitch>
---------------------
HexaEdit.cfm
..
<script>
function saveHTML( ) { ....... }
function initEditor() { ....... }
document.forms[0].onSubmit="saveHTML( );"
document.onload="initEditor();">
</script>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists