Question

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()?

Was it helpful?

Solution 2

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();

OTHER TIPS

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, '') == ""
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top