1

I've a list where there is a choice field A and a metadata field B. I want the metadata field B to be a required field if an option xyz is selected on the choice field A.

How can this be achieved?

1

SharePoint tries to execute a user-defined function called PreSaveAction before an item is saved. You can use that function to validate your data.

Here is a bit of code that should give you a good starting point:

function PreSaveAction(){
  if(jQuery("select[title=A]").val() == "xyz"){
    if(jQuery("div[title=B] > div > .valid-text").length){
      return true
    } else {
      alert("Value in B missing!")
    }
  } else {
    return true
  }
}

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.