validate empty textboxes before leaving the textbox

孤街醉人 提交于 2019-12-13 04:06:00

问题


I am developing an asp web application and I have an online form, I can already prompt the users that the text box is empty after clicking the submit button, however I want to prompt the user that the textbox cannot be left blank..

for example last name, middle name, and first name, when I am on the last name field, and I went to the middle name field, the last name textbox was left empty, I want to prompt the users that the last name textbox was left empty, and when there is already value, the prompt will be removed,

also i want the textbox to be bordered red then resume to normal when there is value,, thanks for your answers


回答1:


If you are using MVC, then use data annotations or you can use any jquery validation library like http://www.position-relative.net/creation/formValidator/demos/demoValidators.html



来源:https://stackoverflow.com/questions/19355516/validate-empty-textboxes-before-leaving-the-textbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!