top of page

Forum Posts

GOS
Velo Expert
Velo Expert
Dec 01, 2019
In Coding with Velo
Why do we now get spaces formatted out of our code when we paste it into the forum. Note, that this only seems to happen when I copy and paste code from Microsoft Word, so it might just be an issue with Microsoft Office. If I copy and paste from a simple text document or from a QuarkXPress file or a Adobe Indesign file, then it doesn't format the spaces, although I would never use Quark or InDesign for code samples etc. Like this for example... importwixCRM from 'wix-crm'; $w.onReady(function() { $w("#PublicContactUs").onAfterSave(() => { letname = $w('#publiccontactName').value; letemail = $w("#publiccontactEmail").value; letsubject = $w("#publiccontactSubject").value; letmessage = $w("#publiccontactMessage").value; letlabel = ["Contacted Us"]; importwixCRM from 'wix-crm'; $w.onReady(function() { $w("#PublicContactUs").onAfterSave(() => { letname = $w('#publiccontactName').value; letemail = $w("#publiccontactEmail").value; letsubject = $w("#publiccontactSubject").value; letmessage = $w("#publiccontactMessage").value; letlabel = ["Contacted Us"]; When it should be like this.... import wixCRM from 'wix-crm'; $w.onReady(function() { $w("#PublicContactUs").onAfterSave(() => { let name = $w('#publiccontactName').value; let email = $w("#publiccontactEmail").value; let subject = $w("#publiccontactSubject").value; let message = $w("#publiccontactMessage").value; let label = ["Contacted Us"]; import wixCRM from 'wix-crm'; $w.onReady(function() { $w("#PublicContactUs").onAfterSave(() => { let name = $w('#publiccontactName').value; let email = $w("#publiccontactEmail").value; let subject = $w("#publiccontactSubject").value; let message = $w("#publiccontactMessage").value; let label = ["Contacted Us"];
0
1
38
GOS
Velo Expert
Velo Expert
Apr 11, 2019
In Coding with Velo
For any Wix Users who struggle with Wix Code and can't work out how to do their own custom signup lightbox. Well, if you would still like to have your own custom signup form, then this is now possible for any Wix User to do so. Simply follow the Wix Tuturial on this page to be shown how to do it with the use of Wix Forms: https://support.wix.com/en/article/creating-a-custom-signup-form-for-your-members-area
1
1
100
GOS
Velo Expert
Velo Expert
Apr 11, 2019
In Coding with Velo
For all those Wix Users who keep asking about formatting dates on your website, well you are in for some good news as Wix has finally done something to help you. Instead of having to resort to code which some users will struggle with, it is now possible to do it all from within your text element in Wix Editor. Date Formatting You can now customize how you want to display a date—without writing any code. Just connect a Text element to a Date and Time field in your collection, and then choose the display format from the Connect Text panel.
Date Formatting Now Available In Editor content media
1
0
57
GOS
Velo Expert
Velo Expert
Feb 25, 2019
In Coding with Velo
For those of you who haven't heard the latest news from Wix yet about their increase in speed, then have a quick read of these: https://www.wix.com/blog/2019/02/improve-website-performance-wix-turbo/ https://www.wix.com/turbo/home Although I think that whoever wrote the article must have had a little reminder of their childhood days of watching Power Rangers when they came up with the headline for the article.... Wix Shifts into Turbo!
0
0
122
GOS
Velo Expert
Velo Expert
Feb 13, 2019
In Coding with Velo
@Yisrael (Wix) Using your typewriter code (which is great and just what I was looking for), now how can I adjust it so that the text doesn't just carry on typing downwards in the text box and also set it up to loop again after it has finished? At the present moment I am just using a html iframe which contains a basic marquee effect so that the text scrolls across the screen from left to right, plus it also has a mouseover-stop and mouseout-start so that any users can stop it to read it. Is it possible that I can edit your code and adjust it somehow to make it act like the marquee effect and scroll across the screen instead of typing downwards one line at a time? As for the loop of the typewriter effect, can I simply edit the code at the bottom so that the element refreshes itself instead of stopping, something like this: setInterval(() => { $w('#typewriterPage').refresh(); }, 15000); Or if that isn't possible, the have the page refresh with another html iframe with this inside: <script> var timer = null; function auto_reload() {  top.location.href = 'Enter your URL destination here'; } </script>  <body onload="timer = setTimeout('auto_reload()',5000);">
0
0
78
GOS
Velo Expert
Velo Expert
Jan 29, 2019
In Coding with Velo
I would like to format my date in my dataset to have just the date only. I am not displaying the date anywhere on a web page and the only person who sees that chosen date is the recipient of the triggered email. The variables on the triggered email are just confirming what the user has input into the form, with the variable on the 'startDate' in the page code itself currently being set up as '.toLocaleDateString('en-GB'), so that the date on the email is shown as 01/01/01. However, I would like to be able to edit this date field before the input is saved into my dataset by the use of a beforeInsert hook in a dataset, so when I come to do the email variable I then don't need to worry about having to change the date in the code still. I have got this exising hook for beforeInsert data.js in my backend: export function JoinUsForm_beforeInsert(item, context) { item.firstName = toUpperFirst(item.firstName); item.lastName = toUpperFirst(item.lastName); return item; } export function Members_beforeInsert(item, context) { item.firstName = toUpperFirst(item.firstName); item.lastName = toUpperFirst(item.lastName); return item; } function toUpperFirst(s) { return s.charAt(0).toUpperCase() + s.slice(1); } What I would like to do is to add a formatDate beforeInsert option to the first dataset too, so that it takes the input from the date picker on my form and then saves it as just the date into the dataset. Something like this: export function JoinUsForm_beforeInsert(item, context) { item.firstName = toUpperFirst(item.firstName); item.lastName = toUpperFirst(item.lastName); item.startDate = formatDate(s)(item.startDate); return item; } export function Members_beforeInsert(item, context) { item.firstName = toUpperFirst(item.firstName); item.lastName = toUpperFirst(item.lastName); return item; } function toUpperFirst(s) { return s.charAt(0).toUpperCase() + s.slice(1); } function formatDate(s) { return s.split(' ').splice(0,4).join(' '); } However, I have tried it and so far it doesn't work, it will still show the date as the full date and time unless I keep the email variable as .toLocaleDateString('en-GB') in the page code itself. Anybody know a way to do this as I have only seen so far in the code forum, how to format dates when you are displaying the result on a page.
0
1
217
GOS
Velo Expert
Velo Expert
Jan 28, 2019
In Coding with Velo
I've set up a triggered email form using code with help from Steve(Mod) which is shown at the end of this post. It basically saves the users inputs into a dataset and then creates a new contact with custom fields in contacts being filled in as well, then it sends a triggered email with variables back out to the user. It all works fine apart from the date on the email variable is shown currently as date and time from the dataset field as we are using the following line: "startDate": startDate.toString() Whereas I would prefer to use one of these below so that the date is formatted to just show the date on the triggered email: "startDate": startDate.toLocaleDateString('en-GB') // Shows as 29/01/2019 "startDate": startDate.toDateString() // Shows as Tue Jan 29 2019 (Prefer this to be Day-Date-Month-Year if possible using hook or js module) However, when either of the above two lines are used in the code instead of the existing line, then for some reason it creates two identical contacts for that user. One showing new contact with only the label shown, with the other one being their last activity on the website and all the inputs from the input form. Now obviously it shouldn't be splitting the one contact into two seperate contacts, plus currently there is no way of merging duplicate contacts. So, there must be a simple fix for this! Can I just change the existing code somewhere or add something like this into it: let item = $w("#JoinUsForm").getCurrentItem(); let startDate = item.startDate; startDate = startDate.toDateString(); // or startDate.toLocaleDateString('en-GB'); Or can I add it somehow in a BeforeInsert hook through the dataset and have it as a data.js in my backend? (I currently have one already setup for making sure that first letter of first and last names are caps on different datasets). Or can I install node packages in my backend and import either Moment.js or DatePicker.js into the page code or the hook in backend? (I have already tried installing both and testing them in my data.js in backend, however it is still creating duplicates, so no doubt the coding for it was wrong and it didn't work soI have uninstalled both and taken back out the code.) This is the code that I am using for my form, creating contact and sending triggered email: import wixCRM from 'wix-crm'; $w.onReady(function () { $w("#JoinUsForm").onAfterSave(() => { let startDate = $w("#startDate").value; let firstName = $w('#firstName').value; let lastName = $w('#lastName').value; let email = $w("#email").value; let choirRole = $w("#choirRole").value; let readMusic = $w("#readMusic").value; let choirBefore = $w("#choirBefore").value; let startNow = $w("#startNow").value; wixCRM.createContact({ "firstName": firstName, "lastName": lastName, "emails": [email], "Choir Role": choirRole, "Read Music": readMusic, "Choir Before": choirBefore, "Start Now": startNow, "Start Date": startDate }) .then((contactId) => { return wixCRM.emailContact('joiningusform', contactId, { "variables": { "firstName": firstName, "email": email, "choirRole": choirRole, "readMusic": readMusic, "choirBefore": choirBefore, "startNow": startNow, "startDate": startDate.toString() } }); }) .catch((err) => { // handle the error if the email wasn't sent console.log(`Error: ${err}`); }); }); });
Getting New Contact Duplicated in Wix Contacts If Formatting Date From .toString() to either .toLocaleDateString('en-GB') or .toDateString() content media
0
0
250
GOS
Velo Expert
Velo Expert
Jan 22, 2019
In Coding with Velo
I have setup a 'join us' form on a website and have used the following code below to save the form details into a database and then to create a new contact and add the same custom fields into the new contact details. The database fields are being filled in and a new contact is created, however the custom fields in the new contact is not being filled in with anything and it doesn't send out an email in return to the new contact as per the code should do. The fields used are as listed below as this 'Wix CRM Custom Field Name / Form Input Value: First Name / firstName Last Name / lastName Email / email Choir Role / choirRole Read Music / readMusic Choir Before / choirBefore Start Now / startNow Start Date / startDate import wixCRM from 'wix-crm'; $w.onReady(function () { $w("#JoinUsForm").onAfterSave( () => { wixCRM.createContact({ "firstName": $w('#firstName').value, "lastName": $w('#lastName').value, "emails": [$w("#email").value], "Choir Role": $w("#choirRole").value, "Read Music": $w("#readMusic").value, "Choir Before": $w("#choirBefore").value, "Start Now": $w("#startNow").value, "Start Date": $w("#startDate").value }) .then((contactId) => { wixCRM.emailContact(' joiningusform', contactId, { "variables": { "firstName": $w('#firstName').value, "lastName": $w('#lastName').value, "emails": [$w("#email").value], "Choir Role": $w("#choirRole").value "Read Music": $w("#readMusic").value, "Choir Before": $w("#choirBefore").value, "Start Now": $w("#startNow").value, "Start Date": $w("#startDate").value, } }) .then(() => { // do something after the email was sent }) .catch((err) => { // handle the error if the email wasn't sent } ); } }); }); export function registerButton_onclick(event) { $w("#JoinUsForm").save() } I have viewed this Wix Code tutorial page and went through both sending a triggered email for new contacts and members wix code and it does not work even with following the guide. Wix Code Tutorial Link I have also looked at this Wix Code Forum post about using custom fields in contacts and it states that '- custom fields "keys" should be exactly as written in CRM app (i.e. case sensitive and with whitespaces if required). ' Forum Post Link Therefore my custom field in contacts of Choir Role should be Choir Role in the code and not choirRole as I would have assumed before., however after changing it to the code above, it still does not want to save anything in the custom fields. As the code seems to not work for the sending email, I have setup two Wix Automations that trigger when the form is submitted. One Automation is an email back to the form filler, whilst the other Automation is an email back to myself informing me that a form has been submitted. However, on both emails the date field is shown as 'Tue Jan 29 2019 00:00:00 GMT+0000 (Greenwich Mean Time)', when I just want it to be displayed as 'Tue Jan 29 2019' If I use Wix Forms to make up the exact same form and use the select date picker from there, then the email fields are displayed correctly as 'Tue Jan 29 2019'. But I'm not using Wix Forms and be limited to only five forms in free option or pay each month just for being able to use Automations with it and have unlimited forms when we can do exactly the same thing in Wix Code for free! So is there a way that we can change the fields in both email replies to show just the 'Date Only' option? Wix Support have already replied and stated that I can try putting the Date and Time field as text, however when doing this the date picker on the form itself will not let me link the database to that field as it is now not Date and Time! Only way to alter it so far by their theory is to do it manually and that defeats the object of having the triggered email after the form is filled in!
0
11
1k
GOS
Velo Expert
Velo Expert
Jan 12, 2019
In Coding with Velo
I have a members page setup which only shows a picture and login button if members are not logged in, so when members do log themselves in, then the login button reverts to a logout button and a members only strip is shown which contains all of the members only bits for that page like recent blog/forum posts and buttons to other member pages etc. This members only strip is collapsed if members are not logged in and I have another strip called footer strip that is in position so that when the login button shows login then it is shown on page and the footer should be lined up underneath this footer strip. With the members only strip being collapsed, then this should get rid of the empty white space that is currently shown when nobody has logged in yet and the footer should be positioned at the bottom of the footer strip which when viewed on desktop or mobile would be at the bottom of the screen and not at the bottom of the members only strip. However, even with the code all set out as below and with the members only strip being collapsed until members log themselves in, I can't get the footer to move up to be underneath the footer strip, I can only get the footer up to the bottom of the members only strip and it won't move up any further. So am I assuming that the footer on any page can only be moved up to whatever is the lowest item on the page? Or does anybody know of a way in which I can get this collapsed members only strip to allow the footer to move up above it so that it rests underneath the footer strip. Thanks if anybody can for me. Code used on page: // For full API documentation, including code examples, visit http://wix.to/94BuAAs $w.onReady(function () { //TODO: write your page related code here... }); import wixUsers from 'wix-users'; import wixData from 'wix-data'; import wixLocation from 'wix-location'; $w.onReady( () => { if(wixUsers.currentUser.loggedIn) { $w("#loginbutton").label = "Logout"; $w("#membersareaonlystrip").expand(); $w("#whitegapforfooter").hide(); } else { $w("#loginbutton").label = "Login"; $w("#membersareaonlystrip").collapse(); $w("#whitegapforfooter ").show(); } } ); export function loginbutton_onclick(event) { // user is logged in if(wixUsers.currentUser.loggedIn) { // log the user out wixUsers.logout() .then( () => { // update buttons accordingly $w("#loginbutton").label = "Login"; $w("#membersareaonlystrip").collapse(); $w("#whitegapforfooter ").show(); } ); } // user is logged out else { let userId; let userEmail; // prompt the user to log in wixUsers.promptLogin( {"mode": "login"} ) .then( (user) => { userId = user.id; return user.getEmail(); } ) .then( (email) => { // check if there is an item for the user in the collection userEmail = email; return wixData.query("Members") .eq("_id", userId) .find(); } ) .then( (results) => { // if an item for the user is not found if (results.items.length === 0) { // create an item const toInsert = { "_id": userId, "email": userEmail }; // add the item to the collection wixData.insert("Members", toInsert) .catch( (err) => { console.log(err); } ); } // update buttons accordingly $w("#loginbutton").label = "Logout"; $w("#membersareaonlystrip").expand(); $w("#whitegapforfooter").hide(); } ) .catch( (err) => { console.log(err); } ); } } export function profilebutton_onclick(event) { wixLocation.to(`/Members/${wixUsers.currentUser.id}`); } export function entermembersbutton_onclick(event) { wixLocation.to(`/members-area`); } export function myaccountbutton_onclick(event) { wixLocation.to(`/account/my-account`); } export function websiteupdatebutton_onclick(event) { wixLocation.to(`/website-update`); }
1
2
1k
GOS
Velo Expert
Velo Expert
Jan 10, 2019
In Coding with Velo
Hi, I currently have two basic searches set up on a page of a website, one for finding a musician's name and another one for finding a word within a song name, then both search results are shown in the same results table. However, is there a way that I can change the code so that I can have just the one search box for when people want to find either a musician's name or part of a word from a song if they can't remember the full song name? I've looked on Wix Code Forum and can see code answers for multiple searches, however that is through searching a database with repeaters displayed on the page and people can choose from drop down options too, whereas I have just my repertoire database which is an alphabetical list of songs and the musician's name which people can search through. Talking of drop down, is there also a way to change the musican's name search from a word search and have it as a drop down search instead, albeit with some of the code being able to edit out duplicates of any musician's name, as I've tried adding a drop down choice for the musician's name instead and I can never get it to hide any duplicates. This is the code that I've used and is working fine as separate searches for either finding musician name or word/s from song name: import wixData from 'wix-data'; //For full API documentation, including code examples visit http://wix.to/94BuAAs $w.onReady(function () { //TODO: import wixData from 'wix-data'; }); export function searchButton_onClick(event) { wixData.query('RepertoireList') .contains('songName', $w('#songnameinput').value) .find() .then(res => { $w('#resultsTable').rows = res.items; }); } $w.onReady(function () { //TODO: import wixData from 'wix-data'; }); export function searchButton1_onClick(event) { wixData.query('RepertoireList') .contains('artistName', $w('#artistnameinput').value) .find() .then(res => { $w('#resultsTable').rows = res.items; }); } Any help for a novice wix coder would be must grateful, thank you!
0
5
117
GOS
Velo Expert
Velo Expert
Jul 12, 2018
In Coding with Velo
Is there any way that I can have the footer automatically appear at the bottom of every page on a website regardless of content etc and not by freezing the footer either, so that if page content doesn't fill the viewing screen then the footer doesn't leave background showing underneath. I don't want to freeze footer on any page and whilst the footer is fine on most pages, there are a few pages that don't have enough content to fill the screen and so the footer is set underneath the content body with the background image showing below. I would prefer the footer to be at the bottom of each page regardless and don't want to have to manually adjust the page height and move footer down on each of the pages that don't have enough content to fill the screen. Is there a simple html code that I can embed into the footer or by adding to the site code section via wix code or is this something that wix will be looking to implement later on if it gets enough demand too?
0
1
559

GOS

Velo Expert
+4
More actions
bottom of page