Hello everybody and happy new year !
I have set a rating input element called ‘‘ratingsInput1’’ and rating display connected through a dataset to a collection. It is working but what I want is to let visitors rate only once.
I tried this code but it is sending an error telling it cannot read neither the ‘‘change’’ property nor the ‘‘disable’’ property.
Any help would be appreciated.
Thank you
$w.onReady( function () {
!local.getItem(“x”) if ($w.ratingsInput1.change())
{local.setItem(“x”, “yes”)} if (local.getItem(“x”, “yes”)){$w.ratingsInput1.disable()}
})
The RatingsInput component does not have change or disable properties. See the RatingsInput API for more details on the properties and functions available.
Thank you, Yisrael, but on my website people would vote without being registered. Looking for a solution for this, is about the star rating system that should be limited to a single vote.
It’s almost impossible to limit to one vote without having the users logging in. You can use local storage and save a created hash id for each visitor. Then when a user visits check the local storage and see if they’re a returning visitor. However, if they clear cookies/cache you’re back to zero.
The only way to be sure is to use a login. The Ratings example is simpler and you can try to adapt it to your needs.