Hey, I have created my form with Wix Code, but end up getting a problem with custom validations. I used the example template from Wix: https://www.wix.com/code/home/example/Custom-Validations
I followed the steps, and the code looks like this:
$w('#dataset1').onBeforeSave(() => {
if (!($w('#input5').valid && $w('#textBox1').valid && $w('#input6').valid)) {
let validationMessage = '';
if (!$w('#input5').valid) {
validationMessage += 'Please enter a title\n';
}
if (!$w('#textBox1').valid)
validationMessage += 'Please enter a valid description\n';
if (!$w('#input6').valid)
validationMessage += 'Please enter an address\n';
$w('#validationMessages').text = validationMessage;
$w('#validationMessages').expand();
}
else
$w('#validationMessages').collapse();
});
The "property" page on the text I want to expand if there is a problem in the form looks like this:
Any suggestions?
Hi,
Have you remembered to change the element's names to their actual ID in your site?