I have an "Issue list" and I am writing some jquery code to validate some fields based on the status of the issue.
I am using PreSaveAction() function to make the validation, but I see that the fields which are set as required via the UI are not validated. I have to validate them as well. What is the best way to do custom validation in new/edit forms, but still retain validations of other fields which are already set as required via UI?
Asked
Active
Viewed 1,383 times
1
Falak Mahmood
- 17,298
- 2
- 40
- 67
Imir Hoxha
- 1,905
- 6
- 28
- 55
-
if you simply return false if there is a validation problem, or true if it is all good client-wise, the ootb validation should take care of the the remaining pre-existing validations – Tiago Duarte Jul 02 '15 at 13:39
1 Answers
3
When a field is set to required, then Required Field text is added to the title of the field. So, do something like this:
function PreSaveAction(){
if($('input[title="FieldName Required Field"]').val() == ''){
alert('Please enter some value');
return false;
}else{
return true;
}
}
Keerthi
- 1,113
- 2
- 15
- 32