Check form entries before saving to Db

I really need help coding my Wix page (form) so it will check if fields (could be one or more) are not empty before allowing to save the form to a Database.

My form has 5 fields connected to a dataset and a save button onClick to save to my database ListeMembres.

I need to make sure all 5 fields have been filled in (mandatory).

How will you code this?

I am still new in coding with Wix Code.

Thank you for your help!

Pierre Lacasse

HI,
anyone has a way to filter a collection on a specific field but only displaying items that begin with the same letter?

Example will be to click on a button that will only filters the items that begin with the letter “D”

Results on the repeater:

Dalia
Danduran
Ducan
Dufferin

and not
Andres

Thank you

Pierre Lacasse

Hi Pierre,

the code examples link below has the information regarding form validations.

As per collections question. once you have collection of strings as variable, you can go over it and filter those that starts with specific Letter. Here is some small code snippet that might help you:

let all = [‘abc’, ‘avc’, ‘bca’];
let filtered = ;
l et filterBy = “a”

all.forEach( function (element) {
if (element.startsWith(filterBy, 0)) {
filtered.push(element)
}
});

console.log(filtered) //prints only ['abc', 'avc'] 

Hope it helps,
Dima

Thank you for your reply.
How do I use this with a Collection and a repeater?

Thank you

Pierre Lacasse