RatingsInput reset value to empty state returns error

Hi,

I am trying to reset RatingsInput to empty state in accordance to
https://www.wix.com/corvid/reference/$w.RatingsInput.html#value which is

if(this_val==0){this_val = null;}
$w('#ratingsInput0').value = this_val;

, however I was met with

, the image is very small but its saying ‘The value parameter that is passed to the value method cannot be set to the value NaN. It must be of type integer’.

So as it is stated in the API:

To reset the ratings input element, restoring it to the empty state, set the value property to null or undefined.

It works for me with this simple set up:

https://www.screencast.com/t/2s8DfPpnda0

Which means that you can assign it to null.

Check if your variable this_val gets the correct value (as far as i understand you need it to be null) from your code logic using console.log() (then you can see what you are trying to assign to be the $w(‘#ratingsInput0’).value)

It’s stopped returning errors a few hours after I posted the question. I am not sure why. Possibly I have changed that part of code, or its something to do with my browsers cache. But anyhow, it works now! Thanks a lot for the tips!

1 Like