I've been searching and shooting in the dark for 2 days and
can't get this to work...
I need to have my flash form button execute a javascript,
return the value to the form and then I need the form to submit and
take advantage of cfform's validation.
So far, I get the javascript to change the value of the form
field without submitting the form, but when I add the submit line,
the form submits before the javascript returns the changes.
Here is my sample:
<script language="JavaScript" type="text/javascript">
function changeSomething(x,z1,z2)
{
var z3 = "window.document."+z1+ ".SetVariable";
if (x != "ABCDEFG")
{
eval(z3+"(z2+'.text', 'INVALID Name')");
}
}
</script>
<cfsaveContent variable="prevalidateIt">
getURL("javascript:changeSomethig('"+name.text+"','Step1','name')");
submitForm();
</cfsavecontent>
<cfform method="post" name="Step1" preloader="no"
format="flash" width="960">
<cfformgroup type="panel" label="Step 1" visible="yes"
enabled="yes">
<cfformgroup type="hbox" visible="yes" enabled="yes">
<cfformgroup type="hbox" width="200" visible="yes"
enabled="yes">
<cfinput type="text" name="name" size="12" maxlength="11"
width="12" label="name" validateat="onSubmit" validate="maxlength"
required="yes" />
</cfformgroup>
</cfformgroup>
<cfformgroup type="hbox" visible="yes" enabled="yes">
<cfformgroup type="hbox" visible="yes" enabled="yes">
<cfinput type="button" name="Submit" value="Submit"
onclick="#prevalidateIt#" />
</cfformgroup>
<cfformgroup type="hbox" visible="yes" enabled="yes">
<cfinput name="Reset" type="reset" id="Reset"
value="Reset" />
</cfformgroup>
</cfformgroup>
</cfformgroup>
</cfform>
My javascript is of course way more complicated than this one
and goes through several steps of validation of the form field. It
will ultimately be used on multiple fields in the form.
Has anybody else tried to do something similar.
Thanks!