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!

validateat="onsubmit" not working 1

Status
Not open for further replies.

hpvic03

Technical User
Aug 2, 2006
89
I've got a simple coldfusion form, with a cfinput type=text and validateat="onsubmit" and validate="email" and required ="yes".

But it will not validate onsubmit, nor onblur. It will only work for onserver. Why is it doing this? Any ideas?

Thanks!
 
No idea why it wouldn't without seeing each version of the code. They all work for me. Do you have Javascript turned off in your browser?

Validating at anything except server means that people can bypass your validation. JavaScript (JS) is used for all other validateat (with format="HTML") except server, and turning JS off means that they can input (or exclude) whatever data they want regardless of validation rules you set. Even if your using flash or they have Javascript turned on they can generate those HTTP requests with another tool and put anything they want in the POST varible. Aside from the validation, you also need to sanitize against HTML injection (and SQL injection if your using a database).

Also, cfform generates form tags that are not compliant with XHTML 1.0 strict. If you want or have to meet these validations and you want real protection of your data, don't bother with cfform, and use regular html code for your forms.

[plug=shameless]
[/plug]
 
how do you do sql injection protection? i am using a database
 
oh, i've been using cfqueryparam most of the time anyway just because my database would not read the the data correctly unless I did that.

i'll check and see where my cfform.js is

thanks starlight
 
You're welcome. You can also use cfform's "ScriptSrc" to point to the location of your cfform.js file.
 
awesome, that was the problem. I just copied the CFIDE/scripts directory into every possible folder that could be my webroot (i wasn't sure haha) and now it works.

thanks
 
<cfqueryparam ... " will sanitize information in queries. You can also add another level of protection by making your database not allow semicolons in a query (and have it add ones at the end of the query automagically), and lastly to protect against HTML/CF injection just make sure to change <'s to &lt;'s.

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top