Hi guys I want to connect minimum and maximum variables with two textbox. Later I’ll use between function for filter. Please help!
Dont understand your question :S
You can get the value of a textInput box with
let yourvalue = $w(“#textinput”).value;
or you can set a variable for textboxes
var textboxvalue = “My text”;
$w(“#textbox”).text = textboxvalue;
Sorry for my bad English. I’m trying to get user inputs as max and min values for between function. I want to filter databases.
You will find the right filter here…
https://www.wix.com/velo/reference/wix-data/wixdatafilter
Between-Filter-example:
import wixData from 'wix-data';
wixData.query("myCollection")
.between("age", 25, 65)
.find()
.then( (results) => {
if(results.items.length > 0) {
let items = results.items;
let firstItem = items[0];
let totalCount = results.totalCount;
let pageSize = results.pageSize;
let currentPage = results.currentPage;
let totalPages = results.totalPages;
let hasNext = results.hasNext();
let hasPrev = results.hasPrev();
let length = results.length;
let query = results.query;
}
else { }
})
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
});
I get it I can set variable value from textbox input. I just want to filter between these two values.
@ramazanbugdayci02
Yes you have 2x INPUT-FIELDS —> MinTL & MaxTL
You surely will have a —> DATABASE, where you store all the TL-values, right?
Let us say the ID of this data-field is —> “tl”
And your TL-values are—>: 10, 55, 99, 75, 44, 31, 22, 81, 67
Example by using —> Wix-Data:
import wixData from 'wix-data';
wixData.query("yourCollectionNameHere")
.between("tl", 25, 65) // ---> This will search all TL-values between 25 & 65 in DB
.find()
.then((results) => {
if(results.items.length > 0) {
let items = results.items; console.log(items)
let firstItem = items[0]; console.log(firstItem)
let totalCount = results.totalCount; console.log(totalCount)
}
else { }
})
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
});
Also do not forget to put all the code into —> onReady() !
@russian-dima That’s work thank you! I’ve also one question. How can I link range values to textbox input? I want to obtain range values from user input.