Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFORM's required fields aren't being required

Status
Not open for further replies.

mike2277

Programmer
Mar 25, 2002
54
US
Hello all,

I'm having a strange problem with all of my pages that are using cfform. On most of my cfforms I have used cfinput fields to require that a user enter text for their first name, last name, etc.

These forms used to work just fine. Now, however, I'm noticing that if I don't enter anything in these cfinput fields and click the submit button it's taking me to the action page without requiring data in those fields.

For example, my code is:
<cfinput type=&quot;text&quot; size=&quot;45&quot; name=&quot;FirstName&quot; required=&quot;yes&quot; Message=&quot;Please enter your first name.&quot;>

You would think that cfinput not allow the form to submit until data is entered but it's just not catching it.

I've even tried to convert cfforms to regular forms and use a javascript to catch it but it's not working either.

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
<!--
function checkform ( form )
{

// ** START **

if (form.FirstName.value == &quot;&quot;) {
alert( &quot;Please enter a subject for your message&quot; );
form.FirstName.focus();
return false ;
}
</cfif>
// ** END **
return true ;
}
//-->
</script>

Any ideas?

By the way, I'm using a Windows 2000 server running ColdFusion MX and SQL Server 2000.

Mike

 
r u using a submit button
<input type=&quot;submit&quot; name=&quot;foo&quot;>

if so try
with your second solution of <form> and javascript

use <input type=&quot;button&quot; name=&quot;Submit&quot; onclick=&quot;checkform('formname')&quot;>

------------------------------------------------------------------------------
brannonH
if( !succeed ) try( );
 
Thanks so much for the suggestion. I tried it just now and it didn't work.

Any other ideas? I'm wondering if this is some kind of server issue because it's happening now on all of my cfform templates when they all used to work just fine.

Mike
 
i would also tell you to use <form> instead of <cfform>
becauseee cfServer writes its own JavaScript which could affect your own javaScript..... naming conflicts etc.....

so try to take out the <cfform> and </cfform> and all the cf form elements <cfiput>, <cfselect>, etc..

and use you own custom javascript validation..



------------------------------------------------------------------------------
brannonH
if( !succeed ) try( );
 
Thanks so much for the suggestions. My hosting company actually was able to fix this issue. There response was:

Your site had no cfide mapping. We created the mapping.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top