top of page

Forum Posts

Sam Groves
Jun 17, 2021
In Coding with Velo
Hi people! I'm trying to use the wix-data API to query the Blog/Posts database. However, I'm unable to use the next() function properly. According to the function's description, it is supposed to skip the pageSize set by limit(). This is the code I'm using: if (postResults == undefined) { let categoryID = getCategoryID(category); return wixData.query("Blog/Posts") .hasSome("categories", await categoryID) .limit(length) .find() .then((results) => { postResults = results; return results.items; }); } if (direction == "up") { if (!postResults.hasNext()) return null; return postResults.next().then((results) => { postResults = results; return results.items; }); } if (!postResults.hasPrev()) return null; return postResults.prev().then((results) => { postResults = results; return results.items; }); length is set to 6 and stays that way; yet when I call next() instead of getting elements 6-11, I get elements 3-8. I can do this manually with skip and an updated variable but I shouldn't need to? Any idea what's going on?
0
4
74
Sam Groves
Oct 18, 2019
In Coding with Velo
Hi, I don't know if I'm being dumb or if it's just not a feature (if so, why?), but my onCustomValidation function for my TextInput field isn't firing on key press. Am I missing something? If this isn't implemented then is there a way around it? I don't want to make this a HTMLComponent if I don't have to... The code I have is as follows: $w('#username').onCustomValidation((value, reject) => { setTimeout(() => { let error = $w("#error"); let errorText = ""; console.log("RUNNING!"); if (value.length === 0) { errorText = "Username is required."; SetError(errorText, error); reject(errorText); return; } value = CheckRegex(value); if (value.length < MIN_LENGTH) { errorText = "Username must contain at least " + MIN_LENGTH + " characters."; SetError(errorText, error); reject(errorText); return; } SetError("", error); }, 10); });
0
8
471
Sam Groves
Feb 18, 2018
In Coding with Velo
Hey there, I'm trying to create a TextInput custom validation to check if the inserted string is found in a database. Here's my current code: import wixData from 'wix-data'; import wixUser from 'wix-users'; $w.onReady(function () { $w("#newUserEntry").onCustomValidation((value, reject) => { $w("#newUserEntry").resetValidityIndication(); wixData.query("UserCollection") .hasAll("user", value.toString()) .find() .then((results) => { if (parseInt(results.length) > 0) { $w("#newUserEntry").validity.customError = true; $w("#newUserEntry").updateValidityIndication(); reject("That user already exists."); } }); }); }); The if statement fires, but the TextInput doesn't update; am I just being stupid?
1
6
458
Sam Groves
Jan 31, 2018
In Coding with Velo
Hey guys, I have a main database that references other databases. I access this database to dynamically display information and media on a webpage. I know that you can access a field by doing: $w("#dataset1).getCurrentItem()["<Enter Field Name Here>"]; Is there a way to do that with references? Example: $w("#dataset1).getCurrentItem()["projects"]["projectLanguage"]; If not, do you have any suggestions on how I may achieve something similar to it? Thanks.
0
2
837

Sam Groves

More actions
bottom of page