What's the best way to highlight a required fi

2020-02-28 02:42发布

I don't find the oft-used "*" to be very nice looking - can anyone suggest a nicer-looking method or point me to an example?

I tried making the field highlighted in red as one person suggested but I did not like the look.

Bold labels might do the trick.

But I really like the idea of "Required" being shown in grey in the field until text is added. Does anyone have code for this?

标签: webforms
9条回答
Bombasti
2楼-- · 2020-02-28 02:55

add style="border: thin red solid;" to the element

查看更多
何必那么认真
3楼-- · 2020-02-28 02:57

I typically have no objections to seeing (required) in a smaller font either right below the field name or adjacent to the entry field.

I could also see using a "textbox watermark" to have the field say "required" in it until they bring focus to the field and start typing.

查看更多
叼着烟拽天下
4楼-- · 2020-02-28 03:00

I've found the answers on LukeW.com to be the most useful. because there isn't a simple solution here. It depends on what percentage of the fields are required, how many fields are in your form, and how long your labels are. For the vast majority of the web, people understand bold to be required, and normal-weight to be optional (if any options are bolded). Only after form validation fails would I present the user with the required-yet-skipped input boxes highlighted.

查看更多
虎瘦雄心在
5楼-- · 2020-02-28 03:00

Might want to check out www.PeterBlum.com - His Professional Validation Package rocks for validating and formatting of controls. He has tutorials for using and numerous examples as well as a detailed manual.

查看更多
爷的心禁止访问
6楼-- · 2020-02-28 03:03

I like the way it is done in the ASP.NET Ajax Control Toolkit for the ValidatorCallout control:

alt text

查看更多
戒情不戒烟
7楼-- · 2020-02-28 03:10

Sometimes it really is justifiable to mark fields as mandatory and optional. However, before you do so, you should question whether it is reasonable to ask the user any non-mandatory information. This applies especially in registration forms.

In registration forms and such, it is much better to ask only the minimum information. After the registration the user can, at will, fill out optional information in separate forms.

After all the unnecessary cruft has been taken out from the form, you might see that there is no need to mark fields as mandatory; either everything is mandatory, or it might be so obvious to the user which fields are optional, that there would be no need to give visual cues about it.

查看更多
登录 后发表回答