Hide and show ''widget'' on a page

hi everyone!!

I’m trying to make appear a ‘‘servicelistWidget’’ depending on wich ‘‘dropdown’’ value change.

I’d tried puthing this code :
import wixData from ‘wix-data’;
export function dropdown1_change(event, $w) {
$w(“#dataset1”).setFilter( wixData.filter()
.contains(“frais,local”, $w(‘#dropdown1’).value)
);$w(‘#serviceListWidget2’).show();
);$w(‘#serviceListWidget3’).show();

But it doenst seem to work… any advice on how i can make it appear seperatly?

Thank you!!!

Hi Keenan,

You need to be a little clearer about the logic that will govern which widget will show.

I noticed that the field key in your setFilter condition, “frais,local”, has a comma in it. Commas cannot be included in field keys, so that can’t be the correct field key.

hi!

in fact all i need is that a #servicewidgetlist appear when a selection is made in the dropdown.

So differtent Dropdown ‘‘value’’ = Different #servicewidget list that appear.

i don’t know if it’s help you at all?

Thanks for the help :smiley:

If you simply want some a element to be shown depending on a dropdown value choice, then you can simply find your answer already in previous forum posts.

https://www.wix.com/corvid/forum/community-discussion/dropdown-selection-to-show-elements

https://www.wix.com/corvid/forum/community-discussion/hide-user-input-box-until-an-option-is-selected-in-dropdown

https://www.wix.com/corvid/forum/community-discussion/hide-drop-down-list-based-on-value-of-another-drop-down-list

Thanks! it really helped me!

Now

I would like to know what to do to add several values ​​for the same query in the formula below:


export function dropdown1_change (event, $ w) {
let value = event.target.value;
if (value === ‘fild1’) { ****** Here I would like to have other values ​​for the same result ******
W $ ( ‘# serviceListWidget2’) show ().
W $ ( ‘# serviceListWidget1’) hide ().
W $ ( ‘# columnStrip3’) hide ().


When I just add with quotes it does not work … I am therefore forced to copy the formulas for all scenarios. 15 times …

Is there probably something simpler?