# Velo Code - Search Fields against a collection - Publishing Issue

**URL:** <https://forum.wixstudio.com/t/velo-code-search-fields-against-a-collection-publishing-issue/33371>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [October 25, 2022, 4:01pm UTC](https://forum.wixstudio.com/t/velo-code-search-fields-against-a-collection-publishing-issue/33371 "2022-10-25T16:01:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike-zingalis](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mike-zingalis/32/35364_2.png) [@mike-zingalis](https://forum.wixstudio.com/u/mike-zingalis)\
**Post date:** [October 25, 2022, 4:01pm UTC](https://forum.wixstudio.com/t/velo-code-search-fields-against-a-collection-publishing-issue/33371/1 "2022-10-25T16:01:52Z")

</div>

Let’s see if this makes sense.

1. I have code for a search which works.

2. Upon publishing the site (with no edits to the site) the relationships for my text / dropdown / search & reset buttons go haywire (like they are trying to relate to the collection listed on the page).

3. If I return and update each search field (and dissociate the collection…leaving it on ‘choose’ as an option) & publish…it will work till next time I publish the website.

So, my issue is not the search itself (maybe). It is the automatic attempt at ‘relationship’ from the search fields that I created to the collection listed on the page upon publishing.

Page: pci-foundation(.) org/studio-info/

Code Used:  
import wixData **from** ‘wix-data’ ;  
$w ( ‘#resetButton’ ). hide ();

$w . onReady ( **function** () {  
//TODO: write your page related code here…

});

**function** search ( ) {

```
**let** title = $w ( '#input1' ). value ; 
**let** programs = $w ( '#dropdown1' ). value ; 
**let** status = $w ( '#dropdown2' ). value ; 

$w ( "#dynamicDataset" ). setFilter ( wixData . filter () 
  . contains ( "title" , title ) 
  . contains ( "programs" , programs ) 
  . contains ( "status" , status ) 
) 
  $w ( '#resetButton' ). show (); 
  $w ( '#resetButton' ). enable (); 
  $w ( '#button7' ). hide ();    

```

}

export function searchButton\_click ( event ) {  
search ();  
}

export function resetButton\_click ( event ) {

```
$w ( "#dynamicDataset" ). setFilter ( wixData . filter ()); 
$w ( '#dropdown1' ). value = **undefined** ; 
$w ( '#dropdown2' ). value = **undefined** ; 
$w ( '#input1' ). value = **undefined** ; 
$w ( '#button7' ). show (); 
$w ( '#button7' ). enable (); 
$w ( '#resetButton' ). hide (); 
$w ( '#dropdown1' ). resetValidityIndication (); 
$w ( '#dropdown2' ). resetValidityIndication (); 
$w ( '#input1' ). resetValidityIndication (); 

```

}

export function button7\_click ( event ) {  
search ();  
}

---

<div class="post-metadata">

**Author:** ![amandam](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/amandam/32/79539_2.png) [@amandam](https://forum.wixstudio.com/u/amandam)\
**Post date:** [October 26, 2022, 2:00pm UTC](https://forum.wixstudio.com/t/velo-code-search-fields-against-a-collection-publishing-issue/33371/2 "2022-10-26T14:00:59Z")

</div>

Hello, I just checked your site and the search does not seem to work at all and there are console errors.

I"m a little confused by the original question and what you are expecting to see on page load (page load looks fine as far as I can tell) please update the issue or let us know if you have found a resolution. thanks!

---

<div class="post-metadata">

**Author:** ![mike-zingalis](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mike-zingalis/32/35364_2.png) [@mike-zingalis](https://forum.wixstudio.com/u/mike-zingalis)\
**Post date:** [October 26, 2022, 2:33pm UTC](https://forum.wixstudio.com/t/velo-code-search-fields-against-a-collection-publishing-issue/33371/3 "2022-10-26T14:33:29Z")

</div>

You are right. The search does not work.

Let’s parse this out into sections of ‘does this make sense?’ to slice it up.

1. There are the search fields, which are separate from the collection

- Does this make sense?

1. The code makes the relationship between the search fields & the collection

- Does this make sense?

1. The search fields AUTOMATICALLY connect themselves with the collection on that page each time the website is published (from ANY page)

- Does this make sense?

1. The errors you see are the AUTOMATIC ASSOCIATION of the search fields to the collection causing an error on the page

- Does this make sense?

Note:  
I updated the search fields & published the site. It currently works.

Page Link:  
[https://www.pci-foundation.org/studio-info/](https://www.pci-foundation.org/studio-info/)

Questions:

1. Are you seeing errors now?
2. Is there a way to prevent AUTOMATIC association of a search field to a collection…so the code can act without duplicity of the field being related?

* * *

Side question:

Not to be ungrateful on this addition of collections (I think it’s great).  
BUT…  
Does WIX have a ‘search app’ that they are in the midst of making (specifically to be applied against a collection on a page)?

It seems like a giant gaping hole to not have search & filter functionality as a byproduct of a collection system as a whole. I think that that should come from your company vs. some outside 3rd party app.

I understand that simple one shot filters can be made, but I also think that about 20 years of base search formats for searches have been identified to create a basic template library. Also, the library is something that makes you better as a company in terms of EASY GUI user tools vs. coders.

 ![](https://us1.discourse-cdn.com/wix/original/3X/7/3/7398026c9fcb79ac18dec7c5a3a87c3351224457.jpeg)

 ![](https://us1.discourse-cdn.com/wix/original/3X/2/7/279a9f9d6269aaaf030351ff08df093cdec7986e.jpeg)

---

<div class="post-metadata">

**Author:** ![amandam](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/amandam/32/79539_2.png) [@amandam](https://forum.wixstudio.com/u/amandam)\
**Post date:** [October 26, 2022, 5:15pm UTC](https://forum.wixstudio.com/t/velo-code-search-fields-against-a-collection-publishing-issue/33371/4 "2022-10-26T17:15:55Z")

</div>

If you read your console error, you will see that it is because .hide is not a function. This is becuase you are calling it outside of the page onReady.

$w(‘#resetButton’).hide(); this is sitting below your import statement which is your first problem.

Fix this error first before you continue and that will potentially help you discover the issue.

The search can’t function because you have an immediate error so there is no way to debug that yet. You must follow your errors first.

---

<div class="post-metadata">

**Author:** ![mike-zingalis](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mike-zingalis/32/35364_2.png) [@mike-zingalis](https://forum.wixstudio.com/u/mike-zingalis)\
**Post date:** [October 26, 2022, 5:24pm UTC](https://forum.wixstudio.com/t/velo-code-search-fields-against-a-collection-publishing-issue/33371/5 "2022-10-26T17:24:57Z")

</div>

Here’s the thing Amanda.

You are talking to someone with no code experience.

1. I hired someone to do this.
2. They ran into a dead end & wanted me to contact you.
3. Talking to me as if I understand this will not help either of us.

I did provide the code that I used in the initial request.

Questions:

1. I know that this isn’t the most sugar-coated request for help, but could you please edit / paste the code back to me working?

2. Could you recommend me to someone who could do the work correctly?

3. Here in the forum: Do you help people with code, or just tell them generally what to do?

I’m already 200+ in on costs & 5 days behind schedule. I need help.

---

<div class="post-metadata">

**Author:** ![amandam](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/amandam/32/79539_2.png) [@amandam](https://forum.wixstudio.com/u/amandam)\
**Post date:** [October 26, 2022, 5:31pm UTC](https://forum.wixstudio.com/t/velo-code-search-fields-against-a-collection-publishing-issue/33371/6 "2022-10-26T17:31:32Z")

</div>

This is a community based forum and not a customer support forum. If you are looking to hire someone to write code for you, you will want to reach out to a developer on the [wix marketplace](https://www.wix.com/marketplace/) .

If you are interested in learning how to debug your code, you may [start here](https://support.wix.com/en/article/velo-testing-and-troubleshooting-your-code#:~:text=If%20you%20see%20errors%20or,Tools%3A%20Debug%20your%20Published%20site) .

If you are interested in learning how to code in velo and how the code loads on the page, [you may start here](https://support.wix.com/en/article/velo-about-the-page-rendering-process)

I am sorry you are frustrated, but this is a community space and not a support forum. You may [reach out to customer care](https://support.wix.com/en/article/contacting-wix-customer-care-for-support) if you require direct support.
