This might sound like a rookie question but here goes. I do have a solution but it's ugly.
Most of my programs validate all the forms fields server side and display any error encountered. I just go through a series of CFIF blocks testing each form field. If invalid, I concatenate an error message to a variable of error messsages found. See sample source for an example.
In this case, I want to stop after 2 errors encountered and only display the first 2 errors encountered.
The only way I can think of doing this is to have a error counter and wrap an CFIF statement around each test to either skip it or skip the concatenation of the error messages if the maxerror counter has been reached.
Is their another way to do this?
<cfif len(trim(form.firstName)) eq 0>
<cfset errmsg = errmsg & errormsg1>
<cfif len(trim(form.lastName)) eq 0>
<cfset errmsg = errmsg & errormsg2>
<cfif errmsg neq "">
display page with errors