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?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communitySharePoint 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
}
}