top of page

Forum Posts

martihub
Jul 08, 2019
In Coding with Velo
So, I have been looking through some Corvid tutorials and wanted to display the date on my website; however, the code that I was given basically keeps refreshing my pages and directing me to my home page after 10 seconds or so. I do know that at the bottom that there is a timeout for xxxx nanoseconds, but I tried removing that, but once again, it just broke the code. Anyway around this or am I doing something wrong? $w.onReady(function () { // Adds a time delay so the visitor anticipates the redirect setTimeout(function () { // Checks the browser locale setting switch (wixWindow.browserLocale) { // Depending on the locale, redirects to a different page case 'fr-FR': case 'fr': wixLocation.to('http://www.inflightprinting.net/?lang=fr'); break; case 'de-DE': case 'de': wixLocation.to('http://www.inflightprinting.net/?lang=de'); break; case 'zh-CN': case 'zh-HK': case 'zh': wixLocation.to('http://www.inflightprinting.net/?lang=zh'); break; case 'es-ES': case 'es': wixLocation.to('http://www.inflightprinting.net/?lang=es'); break; // If the locale is set to any other language, default is English default: wixLocation.to('http://www.inflightprinting.net/?lang=en'); break; } // The timeout value is 6500 nanoseconds }, 6500); });
0
5
116
martihub
Jun 24, 2019
In Coding with Velo
I have used the tutorial: https://support.wix.com/en/article/corvid-tutorial-capturing-and-displaying-ratings to display live ratings on my website; however, the ratings have not displayed. I looked through the console and I do not receive errors in the code itself. console code: export function ratingsInput1_change(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({ 'avg': newAverageShort, 'totalRatings': total + newRating, 'numRatings': (count + 1) }); // save the dataset fields to the collection $w('#dataset1').save() .catch((err) => { console.log('could not save new rating'); }); }); } Though the ratings do not display on the website, I do not see anything getting reported through the data sheet.
0
9
83

martihub

More actions
bottom of page