Click here to Skip to main content
16,011,870 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to check whether form contains validations or not in jquery. Actually when i click on save button all validations visible, then here i want to set one pop up message "Please check Validations" .
in worked on mvc 4 razor application
Posted

Hi sai sagar,

I would suggest an idea to implement your idea,

Declare isError = false variable.
Whenever you validate the control, at that time set isError = true even if a single validation is failed.
While clicking save button check whether isError , if it is true then it should throw "Please check Validations" alert box otherwise it should save the data.

statements for step to step implementation

set isError = false initially<br />
if textbox1 validation is failed <br />
set isError = true<br />
if textbox2 validation is failed <br />
set isError = true<br />
if checkbox is missed to check<br />
set isError = true


In save button click, check the below condition first

if isError = true<br />
throw alert  "Please check validations".<br />
else if isError = false<br />
perform save button action.


This would help you a bit.

Regards,
Rk
 
Share this answer
 
v2
Why don't you use
@Html.ValidationSummary

If any valdiations exists, it will show.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900