Cfform not validating required fields
In today’s blog entry, I want to look at validation at the tag level. In compliant browsers, you immediately get visual feedback when submitting the form: The browser actually prevents you from submitting the form. Two of them are particularly useful - email and url.
Tomorrow’s entry (well, the next entry) will look at some of the Java Script involved, but I was very surprised by how much you could do without writing a line of Java Script. Entering a value for the username and then submitting again automatically moves the error to my password field: How much simpler can it get? These form fields render the exact same as any normal text field, but in terms of validation, they will be a bit more picky about what you enter.
Unfortunately, the button gets disabled when a non-required input is empty because it triggers invalid.
Notice I’ve still got a required username and password.I have been a Cold Fusion fan since the day I discovered it, and remain one to this day. Cold Fusion has been around for over a decade and a half, with over a dozen versions brought to market by three different companies.So, where exactly do I see the use of Cold Fusion as no longer making sense? During that time Cold Fusion has undergone numerous changes, but one thing has remained constant, and that is the reason to actually use Cold Fusion.The form makes the same checks as before, but using this method, it is possible to have different error messages based on the type of error.If the form is submitted without filling any of the fields in, a page that looks like the screenshot below will appear: If the form is completely filled in, but the fields are invalid, the resulting page will look like this: Although it is possible to customize this error template, you do not have as much control over the look and feel of the page as you would if you wrote the form validation code yourself.