We use addcategory (for example, the page for adding a library directory). We require that the directory name cannot be blank.
1. Modify addcategory. aspx
2. Create a New formvalidate. js file in the content directory.
3. We can't forget the backend verification and modify the categorycontroller.
Question 1: I originally wanted to return directly if it is empty, but the page is blank, I can only rerender view the current page, but if there is data from the last request on the page, I can only re-execute the previous action. If there is no parameter, it will take, if there is a parameter, do you have to save it all, that friend knows?
4. Results
A. No input content, focus left
B. After the content is entered, the focus is removed.
Question 2: If this is used, you have to write JavaScript yourself. How can the convenient Verification Mechanism of webform be used in MVC?