1

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?

  • 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 2 '15 at 13:39
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;
}
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.