Let say we have a form which is used to create/edit data and in this form we have one input-text component and one SelectOneChoice component. If both of these fields are mandatory there are times when we see client side validation is happening for input-text but not for select-one-choice.
Take example of this picture
If we wee LastName and Email validation are happening client side and we get proper error message as 'You must enter a value' but DepartmentId validation is happening in model side, which is causing error message as 'Attribute DepartmentId in HRAppModule.EmployeeVO is required'.
Generally this issue occurs when we include a 'No Selection' item for a mandatory attribute while creating LOV.
If we 'Include 'No Selection' Item: client pushes "" value from UI which is not null so client side validation does not happen.
If we don't include 'No Selection' Item: client shows blank initially which is null and once user hit submit, it performs client side validation on it. The moment user selects a value, he would not be able to select blank again as attribute is mandatory. Yes, he can change value but no more blank value selection. Which is good way of forcing him to select something.
Disclaimer: Any views or opinions presented in this blog are solely those of the author and do not necessarily represent those of the company.
Take example of this picture
If we wee LastName and Email validation are happening client side and we get proper error message as 'You must enter a value' but DepartmentId validation is happening in model side, which is causing error message as 'Attribute DepartmentId in HRAppModule.EmployeeVO is required'.
Generally this issue occurs when we include a 'No Selection' item for a mandatory attribute while creating LOV.
If we 'Include 'No Selection' Item: client pushes "" value from UI which is not null so client side validation does not happen.
If we don't include 'No Selection' Item: client shows blank initially which is null and once user hit submit, it performs client side validation on it. The moment user selects a value, he would not be able to select blank again as attribute is mandatory. Yes, he can change value but no more blank value selection. Which is good way of forcing him to select something.
Disclaimer: Any views or opinions presented in this blog are solely those of the author and do not necessarily represent those of the company.
3 comments:
Thanks a lot Sanjeev. This helped me. :)
welcome kkapani.
Nice Article, thanks for this information
Also check this out
Laptops, Mobiles, Games, Tv, Smartwatches etc Daily Tech News Updates.
Post a Comment