Hi… I have implemented the search function in my website. Do i have to add any coding because of the new server side rendering that wix introduced.
Thanks in advance!
Hi… I have implemented the search function in my website. Do i have to add any coding because of the new server side rendering that wix introduced.
Thanks in advance!
Hi all,
I found a video with predictive filter, I am following all the steps but is not working.
Video Link: Wix Code | How to Create a Search for Your Database - YouTube

Error: ‘#dataset1’ is not a valid selector name
How can I fix it?
Hi,
We have similar issues with our database search. We have 2 drop-down menus and a search bar (see below). All three work independently however we want them to work together to filter a career database. See the site here www.careerbiz.online/
If we filter by location it works fine. But when we try to refine the search with a second filter (all classifications) it resets the ‘location’ filter meaning you can’t filter by both ‘location’ and ‘classification’ simultaneously.
Here is what we have called our various inputs.
Search bar = ‘#input1’
Location drop down = ‘#location1’
Classification drop down = ‘#classification’
Table = ‘#table1’
Dataset = ‘#dataset2’
Database = ‘careers’
We have not had any luck with this question on previous Wix Forum threads. The full code is below, could anyone help us rewrite it and solve our problem? We would be so grateful!!!
Full code:-
export function input1_keyPress_1() {
wixData.query(‘careers’)
.contains(‘title’, $w(‘#input1’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
});
}
export function location1_change(event, $w) {
wixData.query(‘careers’)
.contains(‘location’, $w(‘#location1’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
$w(‘#table1’).show();
});
}
export function input1_viewportEnter(event, $w) {
wixData.query(‘careers’)
.contains(‘location’, $w(‘#location1’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
$w(‘#table1’).show();
});
}
export function classification_change() {
wixData.query(‘careers’)
.contains(‘category’, $w(‘#classification’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
$w(‘#table1’).show();
});
}
Hi
in the both code from this post ( yoav’s codes) –
if item value = " gladiator s " and the search above, given ’ gladiato r ’ will find the item;
and if item value = " gladiato r " and the search above, given ’ gladiator s ’ will not find the item;
is any solution for this ? ? ?
also one more question about “multi fields search” ( on first page this post yoav’s sample codes)
i created “multi fields search” for the first sample code
and how can i will create “multi fields search” f or second sample code ? ? ? as following
1) first sample code for one field:
import wixData from 'wix-data';
export function searchButton_onClick(event) {
wixData.query('my-collection')
.contains('physicalIssue', $w('#searchButton').value)
.find()
.then(res => {
$w('#resultsTable').rows = res.items;
});
}
1.2) first sample code for multi fields:
import wixData from 'wix-data';
export function searchButton_onClick(event) {
wixData.query('my-collection')
.contains('physicalIssue', $w('#searchButton').value)
.or(
wixData.query('my-collection')
.contains('field2', $w('#searchButton').value)
)
.or(
etc...
.find()
.then(res => {
$w('#resultsTable').rows = res.items;
});
}
import wixData from 'wix-data';
export function searchButton_onClick(event) {
let searchValue = $w('#searchButton').value;
let searchWords = searchValue.split(' ');
let query = wixData.query('my-collection')
.contains('physicalIssue', searchWords[0]);
for (let i=1; i < searchWords.length; i++) {
query = query.or(wixData.query('my-collection')
.contains('physicalIssue', searchWords[i])); }
query.find()
.then(res => {
$w('#resultsTable').rows = res.items;
});
}
thanks in advance
heyimattes
So, how could you set two search fields? Add, for example, .contain(‘field2’, searchValue) after the first .contain method?
What can i do if I want the search to be triggered by the “enter” key?
Hi I have followed the tutorial at this link: Velo Tutorial: Adding Collection Data Search Functionality | Help Center | Wix.com
Everything looks to be fine with the code no errors except the table is not returning any values.
Below is a copy of the code on my page:
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
$w.onReady( function () {
//TODO: write your page related code here…
});
import wixData from “wix-data”;
export function SearchButton1_click(event, $w) {
//Add your code for this event here:
// Runs a query on the “Members” collection
wixData.query(‘Workinfo’)
// Query the collection for any items whose “Name” field contains
// the value the user entered in the input element
.contains(‘Area’, $w(‘#iTitle’).value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w(‘#table1’).rows = res.items;
});
}
$w.onReady( function () {
$w(“#table1”).columns = [{
“id”: “col1”,
“dataPath”: “Area”,
“label”: “Area”,
“width”: 100,
“visible”: true ,
“type”: “string”,
}, {
“id”: “col2”,
“dataPath”: “Device”,
“label”: “Device”,
“width”: 100,
“visible”: true ,
“type”: “string”,
}, {
“id”: “col3”,
“dataPath”: “Description”,
“label”: “Description”,
“width”: 100,
“visible”: true ,
“type”: “string”,
}];
});
Im not sure what is wrong I hope somebody can help.
Thanks.
I have just watched the Code Queen Nayeli you tube tutorial:
Which has helped me identify my mistakes. I have now seen the database searching light; and my page is now working. thanks.
I am so happy my video helped you!!! Don’t forget to find my FB group to ask any questions about my videos ![]()
Hi Nayeli, I hope you can help. I could make all you demonstrated on the video. But I want something else. My collectin has a cell with an URL info. I would like to make a search by the title and later on want to click on the URL which is shown at the results. I did my best but couldnt find the solution. Maybe you can help me. Thank you.
Hi Shanette, I’ve same problem. Could you share the solution with me If you’ve already solved?
Hi Yoav, Could you help me about how I can click an url which is shown at the search results? I mean I have an url coloumn at my collection and after search I can see all related coloumns but url is not functional. Actually I want to make a similar view of search results and then people can click on a word such as ‘continue reading’ and then been led to another page. I mean it does not have to written full url at the search results. I’m loosing to much time to fix these easy settings. Thank you.
Hi Yoav, I applied your code (with one difference - searchValue is of the input, not of the button) and it works. Now I need to add the if statement : if there are no results of the serch, I want a certain element to show up (it is hidden on the load).
The problem is that I dont know how to define a null results and how to implement it in the function. Could you please help me with this?
Hi ZIv!, thank you so much for your comments on searching from a database. In my case, I have in my website an input search, a dropdown search and a search button (people MUST select an option from the dropdown search and write something in the search field).
This is the code I have:
export function search_click(event, $w) {
//Add your code for this event here:
// Runs a query on the “formulario” collection
wixData.query(‘formulario’)
.contains(‘location’, $w(‘#input1’).value)
.contains(‘language’, $w(‘#dropdown2’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
$w(‘#table1’).show();
});
}
I should have something wrong because my table doesnt show any results but if I comment one of the rows (like this //.contains(‘location’, $w(‘#input1’).value)) then it filters and shows all about language and IT DOES work.
So, I think, my question is, how can I create a search if I have an input field and a dropdown list to choose from?
Truly appreciate your help on this. Thank you
How to handle if using “checkbox” to search the dataset table? Thanks for advise.
export function searchButton_onClick(event) {
wixData.query(‘ClientDatabase’) .contains(‘name’, $w(’ #textInput1 ‘).value)
.find()
.then(res => { $w(’ #resultsTable ')
.rows = res.items; }); }
Dear Nayeli/Yoav,
I want to add filters on a table created from database collection.
I went through above posts but could not understand the coding part (I am not familiar with coding).
I want to add more than one drop down button and when a user selects values from these buttons and click on search button then it filter the data from table which is just below it.
Could you please help me on this step by step.
We appreciate your interest in really getting the most out of Corvid and how much you want to learn. You will need to familiarize yourself with basic coding concepts to accomplish what you want. There are a wealth of Javascript coding sites which will help you learn Javascript from basic to advanced - Javascript.info is a good one. The Corvid Resources provides tutorials, examples, and articles on getting the most out of Corvid. We are happy to get you pointed in the right direction, but you’ll need to take it from there. As questions or difficulties arise, we are here to help.
You may also want to check out the WixArena - it’s a hub where you can look for Corvid experts for hire.
@yisrael-wix , I hope you are doing good.
Thanks so much for your prompt response.
I will go through the links you mentioned but for the time being could you please share the code with me for below image where button1 , button2 and button3 are dropdown buttons.
I will start with the code you will share and check the output and then I will do some editing for my learning from your code.This way I think I will be able to understand this part which I require for my website right now.
If you could please help me on this.
@ankoma87 Please note that in this forum we do not provide custom coding solutions.
You can start with these two examples which should get you going in the right direction:
Add search functionality to your site by adding input elements to the page and then adding code to enable a search.
Filter results based on multiple selections in multiple filter groups.
Following on from Yisrael, with your comment of ‘…which I require for my website right now.’
Note that people can take that more than just the one way, either as a demand for the code right now or as the website that you are working on right now.
We can assume that you actually meant the latter and not the first as when people demand they tend to not get helped.
As Yisrael says, this forum won’t provide you a way of getting your site coded by us for you.
However, if you are after samples etc to see and look at to get you going, then have a look at the example pages from Vorbly or Code Queen Nayeli for example.