Search

Hello guy, I have a drop down-box with a list of items say, Math, Science, Social Studies then another text box used for user to enter in there search phrase, i want a scenario where a user select the subject (e.g Science) then enter a phrase like “take record”, No I need all the result to be displayed should be only in the science category, result under the Math or social studies should not come up. My current code displays every result where the phrase is found but I don’t want this. here is my code:

export function btnGo_onclick(event) {
let searchvalue2 = $w(‘#txtSubject’).text;
let searchvalue= $w(‘#txtSearch’).value;
$w(‘#DS’).setFilter(wixData.filter()
.contains(‘subject’,searchvalue2)
.contains(‘qwezzy’,searchvalue)
);
$w(‘#txtSubject’).text = “”;
}

1 Like

Hi :slight_smile:

Instead of .contains(‘subject…

Change it to .eq(‘subject…

Thanks for the respones, but when I changed my code to this:

.eq(‘subject’,searchvalue2)
.contains(‘qwezzy’,searchvalue)

their was no item displayed.

Is search value 2 (subject) a dropdown?

If so you use .value to get the value not .text

Change line 2 to .vaue

Then as nayeli said use
.eq(

Cheers