0

In my list, I am validating a lot of columns using the PreSaveAction. I have many look-up columns that I want to be required and the OOTB required field way doesn't cut it.

OK - that's cool. I have all my fields validating, EXCEPT for Enterprise Keywords. No matter what I try, it won't work.

I use the the following in the console: $("div[title='Enterprise Keywords']").find("div[role='textbox']").text();

The output was: "" //the same was true for .val() and .html().

Then, I do: var valEntKeywords = $("div[title='Enterprise Keywords']").find("div[role='textbox']").text();

valEntKeywords == ""; And, the output is: false

Any ideas on how to successfully validate the Enterprise Keywords column with PreSaveAction()?

2 Answers 2

0

Usually there is a unicode character which represents a zero width space. Try this.

$("div[title='Enterprise Keywords']").find("div[role='textbox']").text().replace(/[\u200B-\u200D\uFEFF]/g, '') == ""
0

So, there's a "hidden" input field associated with it.

For my application, since I only had to worry about one such form field, I was able to validate against:

$("input[id^='TaxKeyword_']").val();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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