top of page

Forum Posts

Tristan Bréon
Mar 07, 2022
In Coding with Velo
Hi, I'm trying to change to color of links that are part of the same text element, for instance: each link or pieces of text that are underlined would be in blue. Any idea how to change this? Thanks!
0
4
153
Tristan Bréon
Jan 29, 2021
In Coding with Velo
Hi ! So my issue is that my links are built with the name of the item, and if certain symbols are present in the title, they make a mess and lead to a 404. (such as %, &, +). Example (click, then refresh and it will lead to a 404) : https://www.wehaveadeal.net/deals/TV-Philips-50PUS7555%2F12-(50%22%2C-LED%2C-4K-UHD%2C-HDR-10%2B%2C-Dolby-Vision-%26-Atmos%2C-Smart-TV)/1611930642 My idea is to create a field in my collection that copies the name of the item upon submission by the user, and takes away all the problematic characters (such as &, % and +). It would then be used in the Wix Editor's page settings to build links. Any idea how to code this ? Basically my code would look like this : // button which submits the form with all the data needed (name of the item, price, name of the vendor...) export function button15_click_1(event, $w) { //text83 would take the value of the TITLE of the item (as inserted by user in input5) without taking into account special characters such as % & and +. $w('#text83').text = $w('#input5').value; //???? part missing to create some kind of RegEx // the Fixed Title, ready for URL usage is set into its field in the database. This field will be used in the Wix Editor to build links for items' pages in this dataset $w('#dataset1').setFieldValue('TITLEFIXED', $w("#text83").text); }
0
5
311
Tristan Bréon
Jan 15, 2021
In Coding with Velo
Hi! I want to automatically detect and set links to show a in a certain color when displayed on the website. I already have this bit of code which was related to the CK Editor, but now I've changed for the Wix Rich Text Input. const dataWithFixedLinkStyles = event.data.replace(/\<a/g, `<a style="color:#006bd7; text-decoration: underline;"`); $w('#dataset3').setFieldValue("commentRich", dataWithFixedLinkStyles); Any idea how to apply this to the rich text input? Thanks!
0
6
220
Tristan Bréon
Jan 14, 2021
In Coding with Velo
Hi! It was working all fine until very recently (I feel like Wix have been tampering with some stuff of late). Basically, I have two pieces of text which are formatted with code to be bold when the switch is set to its corresponding value. Now, it still works, BUT it keeps adding "[Removed]" in front of the text every time the switch is activated/deactivated! You can see for yourself here : https://www.wehaveadeal.net/ Try toggling it on and off and you will see. NOTE : the switch only shows on the MOBILE version. Any idea what causes this bug ? Here's the piece of code that runs it : export function switch1_change(event) { //shows deals (mobile) if ($w("#switch1").checked) {         $w("#repeater3").expand();         $w("#repeater4").collapse();         $w("#button25").collapse();         $w("#vectorImage26").hide();         $w("#button18").expand();         $w("#vectorImage27").show();         $w("#textDeals").html = `<style="text-align:center"><span style="font-family:arial; color:#7D7D7D; font-weight:bold; font-size:10px">${$w("#textDeals").text}</span>`;         $w("#textGoodies").html = `<style="text-align:center"><span style="font-family:arial; color:#7D7D7D; font-size:10px">${$w("#textGoodies").text}</span>`;     } else {         $w("#repeater4").expand();         $w("#repeater3").collapse();         $w("#button18").collapse();         $w("#vectorImage27").hide();         $w("#button25").expand();         $w("#vectorImage26").show();         $w("#textGoodies").html = `<style="text-align:center"><span style="font-family:arial; color:#7D7D7D; font-weight:bold; font-size:10px">${$w("#textGoodies").text}</span>`;         $w("#textDeals").html = `<style="text-align:center"><span style="font-family:arial; color:#7D7D7D; font-size:10px">${$w("#textDeals").text}</span>`;     } }
0
0
5
Tristan Bréon
Dec 30, 2020
In Coding with Velo
Hi! I'm looking to change the color of links within a paragraph. https://www.wehaveadeal.net/goodies/Statue-Yu-Gi-Oh%21---Dragon-Blanc-aux-Yeux-Bleus-par-First-4-Figures/1609343988 You can see here that links are underlined (thanks to the rich text field editor) but they bear the same color as the rest, and I would like links to appear as blue. I though the rich text field editor allowed to do this, but it only changes the color of links when typing the text, when submitted, they become plain. Any idea? Thanks!
0
6
69
Tristan Bréon
Dec 27, 2020
In Coding with Velo
Hi ! I'm facing quite an odd issue. The .disable function on a text input doesn't seem to work. I've tried to manually disable it, and add a bit of code that would enable it, and it worked. So why doesn't the other way around work ? Does not work: if ($w('#radioGroup1').value === "Code Promo"){         $w("#input4").value = "";         $w("#input3").value = "";         $w("#input3").disable();     } works (text input manually disabled beforehand) if ($w('#radioGroup1').value === "Code Promo"){         $w("#input4").value = "";         $w("#input3").value = "";         $w("#input3").enable();     }
0
3
40
Tristan Bréon
Dec 20, 2020
In Coding with Velo
Hi! Have you also experienced this? I've come across 3 items which event handlers are deleted for no reason between 2 saves. All 3 happened in the mobile editor. Any way to fix that ?
0
1
11
Tristan Bréon
Dec 17, 2020
In Coding with Velo
Hi ! I'm currently setting up the mobile version of my website. However, I'm running into some weird issues. First of all, all the code I have runs without a hitch on the desktop version, however, some code doesn't run or only runs partially on the mobile website. (for instance, formatted text in a repeater works only on the first item, but not on the following) This has come to make me wonder: do errors in the code on the mobile version affect the well functioning of the latter? What I mean is, I have removed some items from the mobile version, thus some elements that are called in the code can't be found, and it shows me lots of errors. I tried fixing that by implementing the following bit of code to concerned code : import wixWindow from 'wix-window'; if(wixWindow.formFactor === "Desktop"){ } But it didn't seem to have fixed anything. Thanks for the help!
0
3
30
Tristan Bréon
Dec 11, 2020
In Coding with Velo
Hi ! I've come across quite a puzzling issue. I have a repeater in which some data is present such as the title, the price, and the previous price. Everything works fine when the repeater is asked to load more, except for the previous price. I think it is due to it being formatted by a piece of code (I want it struck through). I've only managed to get it to display correctly either when the "first batch" is displayed or when the second one is (by clicking on a button which asks the repeater to "load more") but never managed to get both at once. It's even managed to display one previous price correctly in the first batch, and all 3 in the second ! Makes no sense... Here's the link to it. The repeater is located in the petrol blue box, if you click the "+" button, it will load more. You will see that the previous price of the first batch will switch to its place holder "Prix Ant.". https://www.wehaveadeal.net/deals/Jeu-Devil-May-Cry-5-Special-Edition-sur-PS5/1607703677 I actually have a similar issue somewhere else in my website. It really looks like code-formatted text in a repeater and the load more function don't work well together. Here is my code : $w("#repeater2").forEachItem(($w, itemData, index) => {             $w("#repeater2").onItemReady(() => { The following code is part of this above bit of code. //deals similar to the item                 $w("#dataset4").onReady( () => { //shows only items related to the current item and show the box when items have been loaded                     wixData.query("deals"); let filter = wixData.filter();                             filter = filter                                 .hasAll("categorie", $w("#button31").label);                                 $w("#dataset4").setFilter(filter)                                 .then(() => { if (current) {                                             $w("#box47").show();                                         } else {                                             $w("#box47").hide();                                         }                                 $w("#repeater8").onItemReady(() => {                                     $w("#repeater8").forEachItem( () => { //sets the price in green if the text is GRATUIT if ($w("#text129").text === "GRATUIT") {                                              $w("#text129").html = `<span style="font-family:arial;font-weight: bold; color:#16B326; font-size:14px">${$w("#text129").text}</span>`;                                         } //strikes through the previous price                                         $w("#text138").html = `<span style="font-family:arial; color:#535353; text-decoration: line-through;font-size:13px">${$w("#text138").text}</span>`; //shows the 'updated logo' if the item has been updated (manually) let edition3 = $w("#dataset4").getCurrentItem().edite; if (edition3) {                                             $w("#iconeMAJsimilaire").show();                                         }                                         });                                     });                                 });                             });  export function button65_click(event, $w) {     $w("#button65").hide();      $w("#repeater8").onItemReady((itemData, index) => {             $w("#repeater8").forEachItem( () => { //strikes through the previous price $w("#text138").html = `<span style="font-family:arial; color:#535353; text-decoration: line-through;font-size:13px">${$w("#text138").text}</span>`; //sets the price in green if the text is GRATUIT if ($w("#text129").text === "GRATUIT") $w("#text129").html = `<span style="font-family:arial;font-weight: bold; color:#16B326; font-size:14px">${$w("#text129").text}</span>`; //shows the 'updated logo' if the item has been updated (manually) let edition3 = $w("#dataset4").getCurrentItem().edite; if (edition3) {          $w("#iconeMAJsimilaire").show();                }                        });     });  }  Any idea? Thanks!
0
6
23
Tristan Bréon
Dec 10, 2020
In Coding with Velo
Hi guys! So, I've come across an issue where some URL containing special symbols like parenthises, or plus signs, would change when refreshed, leading to a 404 page. I'd like to specify that the URL is based on the title of the "product" page, and is automatically created. Here is a link to an example. Click it, and it should work fine. But try hitting F5, and it will lead to a 404 page. You can see that the URL has changed, causing this to happen. Any idea how to fix this? https://www.wehaveadeal.net/deals/%5BCDAV%5D-Jeu-Cyberpunk-2077---Edition-Day-One-sur-PS4-%2F-Xbox-One-(%2B20%E2%82%AC-cr%C3%A9dit%C3%A9s)/1607529491 Here is what the URL looks like when refreshed : https://www.wehaveadeal.net/deals/%5BCDAV%5D-Jeu-Cyberpunk-2077---Edition-Day-One-sur-PS4-%2F-Xbox-One-%28-20%E2%82%AC-cr%C3%A9dit%C3%A9s%29/1607529491 You can see that parentheses were changed to some code.
0
10
394
Tristan Bréon
Dec 01, 2019
In Coding with Velo
Hello ! So what I'm trying to do it to display element in a repeater that match the same "category" (reference field in the database) as the item currently displayed. It won't let me select the dataset in the menu (see screenshot) I tried this bit of code to apply the filter on the dataset but it doesn't work : // 'goodies' is the database collection //'collection' is the reference field that is set in the goodies database collection //button31 displays the name of the collection the current item belongs to let filter = wixData.filter(); filter = filter .contains("collection", $w("#button31").label); $w("#dataset4").setFilter(filter); wixData.query("goodies") .contains("collection", $w("#button31").label) .find() .then( (results) => { let numberOfItems = results.totalCount; // collapses the 'goodies smilaires' box if there are no results if (numberOfItems <=1 ) $w("#box47").collapse; }); I also want the repeater to collapse if there are none items to display. So is that a bug or did I do something wrong here? Many thanks!
Unable to set filter on a repeater based on a Reference field content media
0
6
348
Tristan Bréon
Nov 30, 2019
In Coding with Velo
Hello! So I'm trying to create a list of database items that would work as a "items that are similar to the one you are viewing" list, just like many website like Amazon. What I'm trying to do is to query the title of the item that is being browsed, and match similar results depending on words that are contained in both the current item, and the items displayed in that list. For example if the item being displayed is named "PS4 : Spiderman" I want items such as "Spiderman Game" and "Spiderman Artbook" "PS4 : Uncharted" etc... to be displayed in that list. I tried to apply the "contain" filter, both on the dataset, and with code, but it doesn't work. let filter = wixData.filter(); filter = filter .contains("title", $w("#text54").text) .contains("categorie", $w("#button31").label); $w("#dataset4").setFilter(filter); Thanks !
0
1
27
Tristan Bréon
Nov 29, 2019
In Coding with Velo
Hi! I'm trying to hide a database item that is part of a repeater. Simply put, I have a "latest content" list on each item page, and I would like the item part of this "latest content" list to be hidden if the user is currently browsing this item page. Each item has a unique ID, so that's the data I'd use to make that work. Basically : if (item in latest content list) === (same content the user is browsing the page of) then hide this item in the "latest content list" Here's a screenshot so you can see what I'm talking about. https://www.wehaveadeal.net/deals/1574971366 Any idea how to pull this off? Thanks!
Hide a specific database item in a repeater content media
0
8
96
Tristan Bréon
Nov 23, 2019
In Coding with Velo
Hi ! I'm trying to have my event banner in the header collapsed based on one criterion. Here's my code but it doesn't work : if ($w("#text113").text .contains("Black Friday")) $w("#banniereEvent").collapse(); So basically there's an event banner in the header, and I want it to collapse if the user is browsing the current event page. Thanks !
0
4
278
Tristan Bréon
Nov 20, 2019
In Coding with Velo
Hi! I'm trying to show a loading screen (lightbox) after the user submits a form, before being redirected to his submission page, on my website. I have managed to do that, only if the user forgets to fill in an input, the database returns an error, and can't submit the content. So far nothing wrong. But I want the loading screen (lightbox) to automatically close so the user can fill the missing inputs. Basically I need a piece of code that would say "on submission button click = display loading screen; if database returns an error = loading screen hide; Here's my code so far. import wixData from "wix-data"; import wixWindow from 'wix-window'; import {sendEmail, sendEmailWithRecipient} from 'backend/email'; $w.onReady(function () { $w("#dataset1").onReady(() => { const msg = $w("#dataset1").getCurrentItem(); $w("#html1").onMessage((event) => { if (event.data === "ready") { $w("#html1").postMessage(msg.longDescription); //sends out an email when deal is posted $w("#dataset1").onAfterSave(sendFormData); } }); $w("#html1").onMessage((event) => { //Set the value for the rich text field of the dataset's //current item to be the data in the HTML element const dataWithFixedLinkStyles = event.data.replace(/\<a/g, `<a style="color:#006bd7; text-decoration: underline;"`); $w('#dataset1').setFieldValue("descriptionDeal", dataWithFixedLinkStyles) .then((res) => { $w("#dataset1").save(); //shows loading screen upon submitting content wixWindow.openLightbox("Chargement"); }); }); }); }); export function button15_click_1(event, $w) { //Send a blank message to the HTML element. This tells the HTML //element you want it to send you its contents $w("#html1").postMessage("save"); //Receive the message from the HTML element } Thanks!
0
6
59
Tristan Bréon
Sep 28, 2019
In Coding with Velo
Hello all! I'm trying to display and hide elements on an item page depending on the statement of a checkbox in the item database. Basically if the submitted content has been approved by the admin (me), some items will show on the page, else, some items will be hidden. Here's an exemple of a validated item : https://www.wehaveadeal.net/deals/1567425530 Comments show. Here's an exemple of a pending for validation item : https://www.wehaveadeal.net/deals/1569100108 Comments will hide and a message (in a blue box under the item) will show. The thing is, it doesn't work. Any posted item will be considered validated (and hence will show comments etc.) even though the said checkbox in the database is unchecked (and hence its statement is considered as "false") unless I manually check the checkbox, and then uncheck it, which not what I want here. Here is my code : let items = $w("#dynamicDataset").getCurrentItem(); if (items["valide"] === false) { $w("#box42").show(); $w("#text111").hide(); $w("#box33").hide(); $w("#box32").hide(); $w("#button15").disable(); } else { $w("#box33").show(); } I think the "false" statement must be replaced by something else, but what ? Thanks for your help!
0
12
517

Tristan Bréon

More actions
bottom of page