简体   繁体   English

如何使服务器端表单验证与屏幕阅读器兼容

[英]How to make server side form validation compatible with screen reader

if screen reader fill any content wrong then how to give info (if javascript is disabled) to user to go that field any fill the correct value. 如果屏幕阅读器填写的内容有误,那么如何向用户提供信息(如果禁用了javascript),则该字段将正确地填入任何内容。

with JavasSript we can show javascript alert but if JavaScript is disabled then? 使用JavasSript,我们可以显示javascript警报,但是如果禁用了JavaScript,那么呢?

I need a solution for both ASP.NET 2.0 and PHP. 我需要针对ASP.NET 2.0和PHP的解决方案。

There are two main things you should do: 您应该做两件事:

Make it clear there was a problem by displaying an information message at the top of the page. 通过在页面顶部显示信息消息来明确存在问题

Place error messages inside label elements so they will be read in Forms mode. 将错误消息放置在标签元素内,以便可以在“表单”模式下阅读它们。 Make sure you have only one label element per input (some screen readers can't cope with multiple labels). 确保每个输入只有一个标签元素(某些屏幕阅读器无法处理多个标签)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM