I keep getting Parsing Error: Unexpected Token errors, but I’m not sure WHICH token (curly bracket, parentheses, semi-colon) is either there when it shouldn’t be or not there.
I’m trying to validate a series of textInput boxes for length (no more than 1,500 characters):
$w.onReady(function () {
//TODO: write your page related code here...
$w("mission").onCustomValidation((value, reject) => {
if ((value.length < 1500)) {
reject("Entry is too long. Please keep your entry to 1,500 characters or fewer.");
}
$w("#mission").maxLength = 1500;
});
$w("project").onCustomValidation((value, reject) => {
if ((value.length < 1500)) {
reject("Entry is too long. Please keep your entry to 1,500 characters or fewer.");
}
$w("#project").maxLength = 1500;
});
$w("howhelp").onCustomValidation((value, reject) => {
if ((value.length < 1500)) {
reject("Entry is too long. Please keep your entry to 1,500 characters or fewer.");
}
$w("#howhelp").maxLength = 1500;
});
$w("fundingsources").onCustomValidation((value, reject) => {
if ((value.length < 1500)) {
reject("Entry is too long. Please keep your entry to 1,500 characters or fewer.");
}
$w("#fundingsources").maxLength = 1500;
});
$w("howused").onCustomValidation((value, reject) => {
if ((value.length < 1500)) {
reject("Entry is too long. Please keep your entry to 1,500 characters or fewer.");
}
$w("#howused").maxLength = 1500;
});
$w("recognition").onCustomValidation((value, reject) => {
if ((value.length < 1500)) {
reject("Entry is too long. Please keep your entry to 1,500 characters or fewer.");
}
$w("#recognition").maxLength = 1500;
})
Any advice? I’m pretty new to Wix Code, and I’m surprised setting the length/validating a form is considered advanced vs. including it in the Settings for a Field.