Home > database >  Wix: (Javascript) Carry information from a page to another
Wix: (Javascript) Carry information from a page to another

Time:05-09

Issue: Unable to jump and filter information on webpage based off the information from another webpage

Background/Intended behavior: I have 3 web pages: 1. Home Page 2. Law Page 3. Medical Page. Pages 2: Law & 3: Medical, have checkboxes that can filter a repeater of linked images on that page.

From the Home Page the user selects from two dropdown lists: Task and Location. Both task and location are required prior to clicking on a search button. When button is clicked, if the task == a Law task, then user will jump to the law page and the repeater will filter by the task selected and location. (Example: Task = fire fighter / Location = Dallas) Expected Result:

  1. User jumps to Law page
  2. Repeater is filtered by fire fighters in Dallas

The same behavior would apply if a Medial task was selected instead of a Law task. (Example: Task = dentist / Location = Dallas) Expected Result:

  1. User jumps to Medical page
  2. Repeater is filtered by dentist in Dallas

Problem 1: I have searched a lot on Wix.com on how to code for a page to jump to another page based off the information entered. I desire to do an if statement checking the value of the task dropdown list, but I cannot find out how to jump to another page using javascript code in wix.

Problem 2: I also desire to carryover values from one page to be applied in another. Should I just have a global variables that by default is blank but can be altered between all three pages? Then upon load of pages 2 & 3 use that values for the variables to display the filters?

CodePudding user response:

I would create a JSON object to hold the desired values using localStorage. Then call those values to the desired elements when loading the next navigated page.

CodePudding user response:

With php you can use the if and else attributes with the html form attribute you can use checkboxes and with if you can redirect the user to the desired page with an echo ‘window.location’.

  • Related