I have a script that uses a formula for validation. This prevents the dropdown suggestions from appearing,but still validates/shows the red icon in the upper-left corner of the cell if what's entered is invalid. I want to do this for privacy reasons.
const range = coachSheet.getRange(currentValuesFirstRow, 2, currentValuesNumRows);
const topLeftCellA1 = range.offset(0,0,1,1).getA1Notation();
const _escapeRegExCharacters = (s) => s.toString().replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const dropdownClientsRegex = dropdownClients.map(_escapeRegExCharacters).join('|');
const formula = `=regexmatch(${topLeftCellA1}, "(?i)^(${dropdownClientsRegex})$")`;
const rule = SpreadsheetApp.newDataValidation()
.requireFormulaSatisfied(formula) //this is what I need
.setAllowInvalid(true)
.build();
range.setDataValidation(rule);
Is there a way to make this so that it will show suggestions, but only after 3 matching letters are entered?
I'm guessing this can't be done because GAS can't process the code while I'm typing, so I realize I'm testing the limits, but just wanted to make sure. I didn't think the code above was possible either.
I tried changing the formula on the 5th line this but it didn't work:
const formula = `=IF(LEN(${topLeftCellA1})>=3, REGEXMATCH(${topLeftCellA1}, "(?i)^(${dropdownClientsRegex})$"), TRUE)`;