(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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to