Forum OpenACS Q&A: having an astrix show up on the form template if the Q is required

Hello,

This is probably a pretty simple one. but i was wondering how to specify that a little red astrix show up next to those question that are required by the form. I would like to defined this in packages/acs-templating/resources/forms/standard.adp so it shows up on almost all the forms on my site.

Thanks for the help.

This will add a * for form elements which are not defined as optional (ie, required):

<if @elements.optional@ nil><font color=red>*</font></if>

I've been thinking of adding a form attribute "-flag_required_elements" or something like that which could be used in standard template forms to automatically flag required fields.

Then we'd just modify our various form templates in acs-templating/resources/forms to flag 'em when appropriate.

As a usability engineer currently watching someone perform a usability test involving filling out forms (okay, maybe not the world's most attentive usability engineer :)) I want to plea/remind/admonish form designers to make absolutely as little as possible required.  Carefully weigh the expected benefit of more complete data (who will use it?) against user frustration and increased failure rate.  If people like you, they will fill out everything they can, required or not.  If they don't, they'll lie on the required fields or just leave, depending on how badly they want what you have.
I was actually thinking of just always marking required fields. I don't see why you wouldn't.

/Lars

(I was just about to post this as Don ... guess I haven't used IE on this box since the conference :))

Don - that's a great idea! I was thining about it and on this particular site i don't mind if all required fields are flagged, but it would be good to differentiate on most public sites.

Joel - I agree that "in general" most things shouldn't be required for public sites using public services. My setup is for a private site for minors where we both have a pretty captive audience that wants to please us and need certain types of information in order to send out parental consent forms for participation in our "real world" program.

I can see a reason not to mark required fields. If you assume you are a public site, in particular a place like a store, and you want to collect as much info on a person as possible to do better marketing etc. you might want to have the user not know if it is require or not (espcially if most of the fields are not required). This would be done in the hopes that they give you more info then the need to... if you know a field isn't required your less inclined to guess that it might not be necessary. its a bit sleazy, but i can understand it...
Very true - I did just that tonight filling in an on-line registration form that REQUIRED my tel no.  - I didn't want to give it so I gave them 01234 567890 to satisfy their validation.

- Steve
Heh I just gave my date of birth as "1999" on another site requiring a generic profile. And, surprise surprise they think I'm a woman, too!

OK, here's an example of the output of the acs-templating form style (used with ad_form) which marks required elements with an asterisk that I wrote for Greenpeace last summer. Check it out ...

Matthew, the reason you give for not displaying the asterisk in some cases makes sense, but I think it is that rare that I would perfectly happy if the toolkit doesn't support it out of the box, but rather always shows some marker to indicate required fields.

If someone wants to be sleazy he should pay a developer to implement it, not get it for free 😉.