0

I have an edit form with a managed metadata field on an edit form. The field is required. I'm using PreSaveAction to do some rest calls and all before the form is saved. I'm using the following code to trigger the evaluation of the entire form, for example required fields and any custom validation defined in the list settings.

SPClientForms.ClientFormManager.SubmitClientForm('WPQ2')

If the user types a value into the column and clicks into another field or the body/background, the column checks the entry and marks it invalid if no match is found. Or accepts it if a match is found.

But if the user clicks the Save button without first clicking anything else the evaluation of the term never happens and the form gets saved anyways.

How can I tell the form using javascript, "Hey check that term!"

On a regular form without the PreSaveAction, clicking the save button does trigger evaluation of the managed metadata fields.

I've noticed that there is a div with .ms-taxonomy-writeableregion.ms-inputBoxActive applied if the input box is active.

I've tried setting the focus, blur, or triggering a click via jQuery. None of those worked.

Anybody know a javascript call to evaluate a managed term set.

  • Why are you taking on the triggering of the form validation? Why not just return true from your PreSaveAction and let SharePoint handle it itself? – Dylan Cristy Aug 25 '17 at 16:34
  • First because SharePoint isn't handling it it is accepting a non valid term if they user doesn't click anything else before clicking save. But also because I'm trying to do some REST calls only if the form checks out and SP isn't waiting until those have happened. – Rothrock Aug 25 '17 at 17:36

Your Answer

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

Browse other questions tagged or ask your own question.