Forum OpenACS Q&A: ad_form - getting the number of formerrors in the standard template

Hello, i was wondering if there was a away to put a message on the top of my standard form template saying something to the effect of "There were problems with your entry. Please correct the errors below." I have now had a number of users think they submitted something correctly simply because they have old monitors and would have needed to have scrolled down to get the red error message for the form element that wasn't valid. So, whenever there are formerrors I would like to be able to differentiate between singular and plural errors and give them a note saying that ney need to look down. Is there a way to do something like:

<if @formerrors@>
  <if @formerrors.count@ gt 1>
    There were problems with your entry. Please correct the errors below.
  </if>
  <else>
    There was a problem with your entry. Please correct the error below.
  </else>
</if>

If not simply an "if" statement that lets me put up the plural message would be good enough.  Does anybody have any pointers? thanks for the help.

Closest I could come up with is putting something like this in your tcl:

if { [template::form::is_submission $form_name] } {
set formerror_msg "
There were problems with your input. Please correct the error(s) below.
"
}

and this in your adp

<if formerror_msg not nil>
  @formerror_msg@
</if> 
Hi,

You can look at this form template I made.  The errors are shown on top as well as highlighted inline.

http://cvs.openacs.org/cvs/*checkout*/openacs-4/contrib/packages/bcms-ui-base/resources/form-template.adp?rev=1.2

It does use css, you can look at the style here:

http://cvs.openacs.org/cvs/*checkout*/openacs-4/contrib/packages/bcms-ui-base/www/bcms-ui-base-style.tcl?rev=1.1

The style that you will want are between the comments "form template styles".

Thank you! This did it.
Welcome Matthew.  Please take note to test it on older browsers.  I haven't tested that other than mozilla 1.x  since that form style was for a controlled audience.  I did test it on a text based browser (links), works ok.