I have created coding for a ratings input and a ratings display as such:
export function iptUploadPicture_change(event) {
var filesize =$w( “#iptUploadPicture” ).value[ 0 ].size;
if (filesize > 1000000 ){
$w( “#btnSubmit” ).disable();
$w( “#txtError” ).show();
} else {
$w( “#btnSubmit” ).enable();
$w( “#txtError” ).hide();
}
}
export function iptTestimonial_keyPress(event) {
setTimeout(characterCount, 500 );
setTimeout( **function** (){$w( "#txtCharacterCount" ).hide(); }, 4000 );
function characterCount(){
var charsRemaining = $w( “#iptTestimonial” ).maxLength - $w( “#iptTestimonial” ).value.length
$w( “#txtCharacterCount” ).text = "Characters remaining " + charsRemaining;
$w( “#txtCharacterCount” ).show();
}}
export function btnSubmit_click(event) {$w( “#dataset1” ).onReady(() => {
// get the current item from the dataset
const currentItem = $w( “#dataset1” ).getCurrentItem();
// get the current average rating, number of ratings, and
//total ratings for the current dataset item
const average = currentItem.avg;
const count = currentItem.numRatings;
const total = currentItem.totalRatings;
// get the new rating from the ratings input
const newRating = $w( ‘#ratingsInput1’ ).value;
// calculate the new average rating based on the current
//average and count
const newAverageLong = (total + newRating) / (count + 1 );
// Round the average rating to 1 decimal point
const newAverageShort = Number.parseFloat(newAverageLong).toFixed( 1 );
// set the dataset fields to the new average, total
// ratings, and number of ratings
$w( ‘#dataset1’ ).setFieldValues({
‘averageRating’ : newAverageShort,
‘sumOfAllRatings’ : total + newRating,
‘numberOfRatings’ : (count + 1 )
});
// save the dataset fields to the collection
$w( ‘#dataset1’ ).save()
. catch ((err) => {
console.log( ‘could not save new rating’ );
});
})}
but on preview, I am getting this error message:
Loading the code for the Rating page. To debug this code, open cf53f.js in Developer Tools.
Loading the code for the site. To debug this code, open masterPage.js in Developer Tools.
Loading the code for the TESTIMONIALS page. To debug this code, open w64ej.js in Developer Tools.
{…}
json Table Copy JSON
message:
“value Some(1000) for paging.limit is not valid”
details:
{…}
can somebody help with this code?