top of page

Forum Posts

AS
Jul 18, 2023
In Coding with Velo
Hello all, I am using the Wix Blog app and have multiple writers. Instead of linking to the Wix Members profile page when users click on the author's name, I would prefer to link to a custom dynamic page with the author's bio. Is there a way to do this, either using Velo or using native app functionality? This seems relatively simple, so apologies if this is already answered somewhere, but I've spent a good amount of time on this and cannot figure it out. Thank you!
0
2
12
AS
Aug 30, 2021
In Velo Pro Discussion
Hi, I was wondering if there's a way to incorporate the Wix REST API found in the Wix Developers section into Velo to be used on a single site without creating an app. The use case is to create a Wix Group via code. My thoughts are that I can use the HTTP-function API but I'm not sure how. Let me know if you need any more details! Thanks, Ajani
0
6
130
AS
Aug 09, 2021
In Coding with Velo
Hi, I have found a lot of articles looking to integrate Wix forms with MailChimp using wix-fetch, particularly @Toby's post. However, although I followed the other resources exactly, it is not working for me. Here is my code. Backend: import {fetch} from 'wix-fetch'; import {getSecret} from 'wix-secrets-backend' const API_KEY_64 = getSecret('MailChimp'); const LIST_ID = "d4b50956ba"; export function sendToMailChimp(data) { fetch("https://us6.api.mailchimp.com/3.0/lists/" + LIST_ID + "/members", { method: 'POST', headers: { 'Authorization' : 'apikey ' + API_KEY_64, 'Content-Type' : 'application/json' }, body: data }) .catch(err => console.log('ugh')); } // Execute the sample function above by copying the following into your page code Frontend: import {sendToMailChimp} from 'backend/mailChimp.jsw' export function getSubscribers1_wixFormSubmitted(fields) { console.log('hook 2.0') let lastName let email = fields.fields[2].fieldValue let firstName = fields.fields[0].fieldValue if(fields.fields[1].fieldValue !== '') {lastName = fields[1].fieldValue} else {lastName = ' '} if(typeof email === 'string' && typeof firstName === 'string') { var data = { "email_address":email, "merge_fields": { "FNAME":firstName }, "status":"subscribed" }; // Stringify into JSON format let stringData = JSON.stringify(data); // Process request console.log(data) console.log(stringData) sendToMailChimp(stringData); } return data; } Everything in the front end code is working great. My console.log results get me: {"email_address":"a@a.com","merge_fields":{"FNAME":"A"},"status":"subscribed"} Which is exactly what I am looking for. However, it is not translating to MailChimp. Any help greatly appreciated! Thanks.
0
0
17
AS
Jul 26, 2021
In Tips, Tutorials, Examples
Here is a great and complete way I have found for users to save pages once logged in, view their saved pages in their profile, and remove pages from their saved list as well. Masterpage.js import wixLocation from 'wix-location' import wixUsers from 'wix-users' import wixSite from 'wix-site' import wixSeo from 'wix-seo' import wixData from 'wix-data' import {session} from 'wix-storage' import {saveButton} from 'public/saveButton.js' export function button114_click(event) { //this is the save button, which is set to show on all pages if(wixUsers.currentUser.loggedIn) { let currentPage = wixSite.currentPage let pageName = '' if(currentPage.type === 'static') { pageName = currentPage.name } else { //allows for dynamic pages pageName = wixSeo.title } let url = wixLocation.url saveButton(url, pageName) } else { //this part allows the page to be automatically saved once the user is logged in session.setItem('accountNeeded', 'true') session.setItem('previousUrl', wixLocation.url) session.setItem('savedUrl', wixLocation.url) let currentPage = wixSite.currentPage let pageName = '' if(currentPage.type === 'static') { pageName = currentPage.name } else { //allows for dynamic pages pageName = wixSeo.title } session.setItem('savedPage', pageName) wixLocation.to('/login-signup') } } Public/saveButton.js import wixData from 'wix-data' import wixUsers from 'wix-users' export function saveButton(url, pageName) { let updateLinksArray = [] let updatePageTitleArray = [] wixData.query('Members') .eq('_id', wixUsers.currentUser.id) .find() .then( (results) => { let items = results.items if(items.length > 0) { let logUrl = url let logPage = pageName if(items[0].savedPageLinks !== undefined) { updateLinksArray = items[0].savedPageLinks updatePageTitleArray = items[0].savedPageNames let checking = [] function checkIfAlready(checkedUrl) { //this makes sure there are no duplicate entries return checkedUrl === logUrl } checking = updateLinksArray.find(checkIfAlready) if(checking !== undefined) { return 'ALREADY ADDED' } } updateLinksArray.push(logUrl) updatePageTitleArray.push(logPage) let toUpdateLinks = { 'savedPageLinks': updateLinksArray, 'savedPageNames': updatePageTitleArray, '_id': wixUsers.currentUser.id } wixData.update("Members", toUpdateLinks) .then( (results) => { let item = results }) } }) } Login/Signup Page (this is only used if the user is not already logged in) import wixUsers from 'wix-users'; import wixData from 'wix-data'; import wixLocation from 'wix-location'; import {session} from 'wix-storage' import {saveButton} from 'public/saveButton.js' $w.onReady(function () { }); export function loginButton_click(event) { //here there is everything which is needed for a custom log in, which is not necessary to add. You can check out the tutorial for that elsewhere. if(session.getItem('accountNeeded') === 'true') { //this only occurs once the user is logged in because it happens within the .then() after promptLogin() session.removeItem('accountNeeded') saveButton(session.getItem('savedUrl'), session.getItem('savedPage')) } $w('#text193').collapse() }) } } Members Profile Page import wixUsers from 'wix-users' import wixData from 'wix-data' $w.onReady(function () { let userId = wixUsers.currentUser.id let dataArray = [] let id = '' let linksValue = '' let pagesValue = '' wixData.query('Members') .eq('_id', userId) .find() .then( (results) => { let items = results.items let linksArray = items[0].savedPageLinks let pagesArray = items[0].savedPageNames if(linksArray !== undefined) { for(var i=0; i < linksArray.length; i++) { linksValue = linksArray[i] pagesValue = pagesArray[i] id = i.toLocaleString('en') let itemData = { '_id': id, 'link': linksValue, 'pageName': pagesValue } dataArray[i] = itemData } $w('#repeater1').data = dataArray } }) $w("#repeater1").onItemReady( ($item, itemData, index) => { $item('#button116').link = itemData.link $item('#text193').text = itemData.pageName $item('#button118').onClick((event) => { wixData.query('Members') .eq('_id', userId) .find() .then( (results) => { function findToCancel(value) { return value === $item('#button116').link } let savedPagesAgain = results.items[0].savedPageLinks let savedPagesNamesAgain = results.items[0].savedPageNames let checkingAgain = [] if(savedPagesAgain !== undefined) { checkingAgain = savedPagesAgain.findIndex(findToCancel) if (checkingAgain !== undefined) { savedPagesAgain.splice(checkingAgain, 1) savedPagesNamesAgain.splice(checkingAgain, 1) let toUpdate = { 'savedPageLinks': savedPagesAgain, 'savedPageNames': savedPagesNamesAgain, '_id': userId } wixData.update('Members', toUpdate) console.log('REMOVAL SUCCESS') $item('#removeMessage').expand() } } }) }) }) }); Hope this helps! -Ajani
0
1
299
AS
Jul 22, 2021
In Site & Page Design
Hi, I was wondering how to create animations to make it more smooth when the submenu is revealed. This could either be natively or with Velo. Please refer to the short clip below for more clarity on what I mean. On that website, as you can see, when you hover over the menu item, the subpage menu smoothly fades in, and then smoothly fades out on hover out. How can I replicate this on Wix? Thanks!
How to Have Submenu Animations? content media
0
3
392
AS
Jul 18, 2021
In Coding with Velo
Hey all! I was pondering this question the other day: is it better to use Wix Blog or create a custom blog with code and dynamic pages? So I figured I’d start a discussion about it! Here’s the Use Case: I’m the web designer for a climate change educational nonprofit. As a part of our website, we take news articles from reliable sources and break them down. However, as part of the design, I want to include more on each Post Page than Wix Blog provides. Here‘s the discussion: how hard would it be to create a custom blog? And are there any advantages that Wix Blog natively provides (e.g. SEO advantages, etc.)?
0
0
16
AS
Jul 14, 2021
In Coding with Velo
Hi, I want to allow members to save pages. I found this article: https://www.wix.com/velo/forum/coding-with-velo/allow-users-to-save-pages-unsolved, but I didn't understand @Ido (Wix)'s answer. Here's a clearer explanation of what I want to do: On a page there is a button (say button1) When button1 is clicked, then there are one of two scenarios: a) if the user is logged in, then the page is saved in a dataset which is linked to them as a member, and they can access the page later from a profile page of some sort; b) if the user is not logged in, then it prompts a login. Is this possible? Thanks, Ajani
0
9
284
AS
May 25, 2021
In Site & Page Design
Hi, I was hoping to link from one of my repeater items to another repeater item. For instance, let's say I have twenty different items in my collection, one being "Chocolate" and another being "Vanilla" (excuse my lack of creative talent here). I have a link in Chocolate's description that I wish to send the user to the vanilla repeater item as if I was using the scrollTo() function or an anchor. Can I do this? Preferably without code because I need this to be in the text, not as a button, like you see on most websites. Thanks, Ajani
0
2
189
AS
Mar 15, 2021
In Coding with Velo
Hi, This is probably really simple and I'm being dense, but how do you get the specific value of a query given the key. For instance, let's say I define a query: wixLocation.queryParams.add({ "day": y //I defined y above }); Later, how can I get the value of the "day" query key from the URL? Thanks!
0
3
50
AS
Mar 12, 2021
In Coding with Velo
Hi, I'm trying to link dynamically in a repeater based on the results of a queryReferenced dataset. However, I'm getting an error message that doesn't make sense! This is my code with the error message: The same error message comes even outside of the event handler. It just doesn't seem to like the hyphens, but that is the auto-generated field key. Indeed, this is the correct field key! Finally, in the console.log(results) of the queryReferenced, it is correct! How can I fix this? Right now, I am using a workaround where I made another field and simply copy-and-paste the urls from the autogenerated field, but I would like to be able to fix this!! Thanks
Error with itemData content media
0
13
287
AS
Jan 27, 2021
In Coding with Velo
Hi, I'm looking to change the color of all hyperlinks text on a page (or across the site). I found this: https://www.wix.com/velo/forum/community-discussion/how-to-change-the-color-of-every-hypertext-link, but it only works in an HTML event handler. I was wondering how to do this purely within the page onReady handler? Thanks!
0
1
94
AS
Jan 14, 2021
In Coding with Velo
Hi, I had a similar question dealing with index value a few months ago, which @Ahmad explained very nicely, thank you. However, now I would like to do a version of that where it calls on the item. To explain: Let's say I have buttons #Cheese and #Meat. Using the onClick() event handlers for each, I want to switch the dynamic page to the item that corresponds with "Cheese". Does that make sense? If not, please tell me so! Thanks in advance.
0
0
11
AS
Dec 27, 2020
In Coding with Velo
Hi, I want to change the opacity for a button with the onClick functions, but then set the rest of the button colors back to normal! For instance, let's say I have $w('#button1'), $w('#button2'), and $w('#button3'), and they all have a background opacity of 50%. When I click #button3, I want to be able to set its opacity to 75%. However, when I subsequently click #button2, I want to set its opacity to 75% but also set #button3's back to 50%. I want to be able to do this universally, so for each onClick() command set all button opacities back to 50%. Is this possible? Please tell me if this is unclear! Thanks!
0
2
639
AS
Jul 28, 2020
In Coding with Velo
Hi, I want to create a header that shrinks as it goes. So when you scroll, only a part of the header continues with the page. How can I do this with Corvid? I understand that I have to create two separate boxes in my header, one for the "#largeStrip" and one for the "#smallStrip" but I'm not sure what code to use for the scrolling. Thanks! Hope you can help and have a great day!
0
3
216
AS
Jun 27, 2020
In Coding with Velo
Hi, I want to have a series of shapes (say circle1, circle2, circle3, etc.), and I want them to show a box onClick. However, I would like to not have to create a seperate box for each one. Therefore, I would like to connect it so that if the circle10 is clicked, for example, then I want to show the circle10 (or whatever) item in the dataset — a specific item in my dataset. I know this is tall order and I could just be making stuff up, but thanks for any help you can provide!!
0
15
193
AS
Jun 20, 2020
In Coding with Velo
Hi, I want to link from a dataset (like a specific word in the rich text) to an anchor on my website. I know already how to set links, but I'm not sure how to set them to anchors as there is no change in the URL. Thanks!
0
2
165

AS

More actions
bottom of page