Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
bforce #1
cfinput required="yes" and inline javascript conflict
Has anyone experienced a situation where inline Javascript is causing Cold
Fusion's native error reporting to fail. I have a script that tests 2 select
boxes to make sure the user has selected a value, if not, generate an alert.
My regular cfinput fields are set to required="yes" message="myMessage". But
if I have an onSubmit function in tag <CFFORM>, the form will submit and no
alert will be generated for the required cfinput fields. Take out the
onSubmit function and CF alerts as expected. I started noticing this after
upgrading to CF 7. Below is my code:
<script language="javascript" type="text/javascript">
<!--
function CheckForm() {
if (document.forms[0].Country.selectedIndex < 1) {
alert("Please select a country.");
return false;
}
else if (document.forms[0].STATE1.selectedIndex < 1) {
alert("Please select a state.");
return false;
}
}
//-->
</script>
<cfform name="form" action="mreg_pck.cfm" method="post" onSubmit="return
CheckForm();">
MyForm
</cfform>
bforce Guest
-
"Page" and "Rect" props of the Field prop in Javascript API
Page property of the Field property in Javascript Acrobat API returns an array of pages that this field exists in. On the other hand, "rect" property... -
how i use <cfinput type="file" ...> in cfformtype="flash
hi, I want to use the <cfinput type="file" ...> in cfform type="flash . But How ? Regards Prashant -
CFINPUT type="radio" w/ "value" requires "label"
On a Flash form, when you specify type='radio' and value='whatever', the value of the 'value' attribute will be displayed as a label if no 'label'... -
#22197 [Fbk->NoF]: "inline" functions cannot use "static" identifier
ID: 22197 Updated by: sniper@php.net Reported By: j_vanveelen at jea dot ca -Status: Feedback +Status: ... -
#22197 [Asn->Fbk]: "inline" functions cannot use "static" identifier
ID: 22197 Updated by: sniper@php.net Reported By: j_vanveelen at jea dot ca -Status: Assigned +Status: ... -
bforce #2
Re: cfinput required="yes" and inline javascript conflict
Also - Does anyone know what's up with cfxchange.com? Bought a custom tag
from them yesterday and the site broke. Never go the tag and thier site is
down today. I thought it was a pretty active site for CF developers but all
of the posts in thier forum look to be at least a year old. Hope I didn't
get ripped!
"bforce" <bforce@poultryegg.org> wrote in message
news:d5gf4e$70o$1@forums.macromedia.com...> Has anyone experienced a situation where inline Javascript is causing Cold
> Fusion's native error reporting to fail. I have a script that tests 2
> select boxes to make sure the user has selected a value, if not, generate
> an alert. My regular cfinput fields are set to required="yes"
> message="myMessage". But if I have an onSubmit function in tag <CFFORM>,
> the form will submit and no alert will be generated for the required
> cfinput fields. Take out the onSubmit function and CF alerts as expected.
> I started noticing this after upgrading to CF 7. Below is my code:
>
> <script language="javascript" type="text/javascript">
> <!--
> function CheckForm() {
> if (document.forms[0].Country.selectedIndex < 1) {
> alert("Please select a country.");
> return false;
> }
> else if (document.forms[0].STATE1.selectedIndex < 1) {
> alert("Please select a state.");
> return false;
> }
> }
> //-->
> </script>
>
> <cfform name="form" action="mreg_pck.cfm" method="post" onSubmit="return
> CheckForm();">
> MyForm
> </cfform>
>
bforce Guest
-
CF_DAWG #3
Re: cfinput required="yes" and inline javascriptconflict
I had the same problem with calling javascript from the onsubmit attribute in
the cfform tag when trying to validate a field in the form. I got around this
by using the onvalidate attribute of the cfinput or cfselect or any other cf
form type tag. But I don't think you have to use it on the form you provided.
Here is what I would do with your form:
<cfform name="form" action="mreg_pck.cfm" method="post">
<cfselect query="GetCountries" name="Country" display="country_name"
value="country_code" required="yes" message="A country is required">
</cfselect>
<cfselect query="GetStates" name="STATE1" display="state_name"
value="state_code" required="yes" message="A state is required">
</cfselect>
</cfform>
Hope this helps, but let me know if you were looking for something else!
CF_DAWG Guest



Reply With Quote

