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!

very simple cfinput question

Status
Not open for further replies.

leadman

Programmer
Jun 11, 2001
177
US
I just put this following little form up. When I submit the form without putting any info into the text box the form submits to itself. Shouldnt I get a message saying "Please enter text" since I have included [tt]required="yes"[/tt]

[tt]<cfform>
<cfinput name=&quot;tester&quot; type=&quot;text&quot; size=&quot;10&quot; maxlength=&quot;10&quot; required=&quot;yes&quot; message=&quot;Please enter text&quot;>
<input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;submit&quot;>
</cfform>[/tt]
 
I just tried your simple form and it worked on the second try as I failed the first time. I noticed I forgot to save it with .cfm extension instead of .htm and after I corrected the page extension it worked liked it's suppose too. :)
 
I tried your link isn't working or your server is down?
 
you need a method and an action attribute within your cfform tag for the template to work properly. If you add these, your cfinput tag will validate as you want it to.
 
Yep... while just having <FORM> or <CFFORM> works (submits to itself by default), it's not considered a valid HTTP request, and the javascript that CF uses to validate won't fire.

You need to add the method and an action.
-Carl
 
I changed it to include an action and method. here is what I have (it is at ) I have no idea why the link i gave above wont work.

<body>
<cfform action=&quot;form.cfm&quot; method=&quot;post&quot; enablecab=&quot;yes&quot;>
<cfinput name=&quot;tester&quot; type=&quot;text&quot; size=&quot;10&quot; maxlength=&quot;10&quot; required=&quot;yes&quot; message=&quot;Please enter text&quot;>
<input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;submit&quot;>
</cfform>
</body>
 
And you're saying it doesn't work?

It works perfectly here.

Do you happen to have javascript turned off in your browser? Without javascript, CFFORM validation won't happen.
-Carl
 
I have javascript turned on. I'm using IE6 in winxp. This is very confusing. It wont validate on my work computer either (same setup)
 
Have you tried taking off &quot;enablecab=yes&quot;?

I my machine, enabling the cab makes the system hang from quite a long time. Perhaps, somehow, your browser is giving up/timing out and just proceeds with the submit (though, doesn't seem likely).
-Carl
 
I'm having the exact same problem with any cfinput tag that has required=&quot;yes&quot;. This happened when I upgraded from CF5.0 to CF MX at my hosting company. They're looking into it now. Some people do not get the javascript error that I get, but with my database not accepting null strings in certain fields, the form gets submitted anyway and the database returns an error from the null strings.
 
I think I may have found it.


This was a bug and is fixed in the most recent MX updater package. The following was listed as a bug fix on Mar 19, 2003.

General Server-Related Issues
The following general server issues, including data validation issues, have been fixed:


Issue ID
Custom validation error messages were ignored on _required form fields. 45443
 
maybe that update will solve the problem...
if not, we encountered a similar situation which we solved by taking out any carriage returns in the message. This simple issue was ruining all our cfinput validations on a form. Seems unlikely, but it was the source of our problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top