how to make comparison from two drop down and result to open new page

I want to use two drop down and want to a make comparison between two of them selected by user.

Suppose select A from first drop down and B from another drop down
and when press button should appear the result which on page C(Should open the link kof page C)

experts Please help .

Hello Ashish

Here’s some steps you can follow:

  • add two drop downs and the button
  • add on click event for the button from the properties panel
  • on the event get the values of the drop downs

now to link for the result, are you using dynamic pages? is the result one of the drop downs values?

if yes then:

  • after getting the values compare them based of the feature you want
  • use wix location to link to the final result (‘/dynamicPagePrefix’+ Result )

Massa

Hi Massa,
Thanks for your quick response really appreciate.
Could you please tell me how we use on click event on wix , as I am new user on wix and not familiar wit wix code much.

Can you please provide me a sample code(compare two items selected from different drop down and open the the link which on another page) to for this query.

Many thanks

Ashish

Hello Ashish

first you add onClick event from the properties panel (it shows when clicking on the button in the editor mode)

The function will appear in the code section:


That’s a code example of how it would like, however you need to set your comparing condition and the links in a way to match your goal.

I hope this helps! and for further help would you please provide more details or your code so we can help better

Best
Massa

Thanks for your prompt response always appreciate. I am trying to open a comparison page when condition matches Like If From drop down one I have selected Zerodha and from second drop down I have selected 5paisa and when I click to a button ‘compare’ it should open a page where zerodha vs 5paisa comparison is available (mean that page link). Please check website link ( https://www.stockgeni.com/compare-stock-broker ) You will get to know what I want exactly. Please provide me the code so that I can apply. I am new to wix code and know nothing . Please help ! Please Help! Thanks.

Hey Ashish,

I just checked your website and i clearly understand your goal, however you need to do a little coding. now i’ll guide you through the steps. you can always hire a wix expert from to help you get your website ready.

First step: you need to build a data base containing information for each one of them. as to say each field should represent a row title in the vs page. – database

Second step: on the click function you should get the drop down values, here you have two approaches, dynamic pages or session.

dynamic pages : you need to create a dynamic page for each possible vs option. the dynamic data set will be build based of the two options data. on the dynamic page you connect each element to the field that should show data to it.

session : you can save the two values in the session then on “VS page” load you get those values and query the collection and get the result. then set each element value based on this result.
change site content example

I hope this helps!
Massa

I have set up the data base the what cidung i have ti di now to show the result like i wanted earlier .when press the buttin result page should open .

Please write a samle code if you can help .

Thanks in advance
I little dumbo.

I have created database and set up correctly I guess because it is showing in the preview but when I publish the site it’s not appearing live.
I did sync publish and checked but still it’s not showing up.

Can you please help.