Hi,
Is it possible to allow users to only submit a form once? To restrict them from submitting the form again and again.
Hi Alex,
You will need to use custom code to achieve this, which you can access using the Developer options > Javascript.
The general idea is the following:
In the form they are submitting add a Email field, you can set this to be hidden. This will store the Email in the Data Source.
Use a form hook to check if they have already submitted it and reject the promise from submitting the form again.
Example JS:
Fliplet.Hooks.on("beforeFormSubmit", function (data) {
//change the DS id below to the data source where the entries are stored.
return Fliplet.DataSources.connect(123)
.then(function (connection) {
return connection.findOne({
where: {
Email: data.Email
},
});
})
.then(function (record) {
if (record) {
return Promise.reject("You have already submitted the form");
}
});
});
Let me know if you need anything else.
Thanks,
Deb
Please send more screenshots and details so we can try to help better
Hi,
Looks like you are missing some quotes around the string “Screen template - Get in touch” and also if you use the name of the datasource instead of an id you have to use a different JS API. Try this:
Fliplet.Hooks.on("beforeFormSubmit", function (data) {
//change the DS name below to the data source where the entries are stored.
return Fliplet.DataSources.connectByName("Screen template - Get in touch")
.then(function (connection) {
return connection.findOne({
where: {
Email: data.Email
},
});
})
.then(function (record) {
if (record) {
return Promise.reject("You have already submitted the form");
}
});
});
It works. thank you