i found this thread and figured that my question would be somewhat relevant.
i am trying to figure out various ways to validate form input data in openacs.
1) via ad_page_contract: this one displays a brief error message and instructs user to use the back button;
2) ad_form validate flag, does this one actually invoke form::element validate, or does it's own validation?
3) form::element validate flag;
finally, i am looking at
https://openacs.org/doc/acs-templating/demo/sandwich,
where the form has inline validation, ie the form is redisplayed with specific error messages. yet, looking at the code, none of the above options are being used. what i have noticed that the only field that doesn't generate a validation error when not populated, vitamins, has a -optional flag to from::element.
hence my questions:
1) in the acs-template docs the form::element actually is not documented as having such a flag available; the form::request, however, does... out-of-date documentation, or does form::element pass the flag onto request (just guessing here, without detailed knowledge of the code).
2) if ad_form is just a wrapper around form templ. functions, is the -optional flag getting set for all elements by default? in other words, it seems like no validation takes place in ad_form unless i explicitly create validation blocks. so, i am trying to figure out how the -optional flag factors into this (as in the sandwich example above).
thanks for all your help and patience,
--sasha