I have 3-4 pages that link to a page with a form on it. Is it possible to pre-select an answer from a dropdown box in the form based on which of those pages the user came from.
Furthermore, is it possible to change the placeholder text of a paragraph field in the same form based on the selection of the dropbox field.
@Yisrael (Wix) Hi, I am facing the same problem here. My first page is using normal Text column to try to link to a page where the info can be readily displayed on the selected dropdown on target page. My first page Text is #text11 and target page dropdown is #dropdown1 with value All, Men, Women. It is a fashion page for user to click #text11 on first page and direct them to the info displayed by the selected dropdown page (for eg: all women clothing on target page once they click Shop Women on first page)
import {session} from 'wix-storage'; $w.onReady(function () { $w("#text11").link = "/dropdown1"; }); export function dropdown1_click(event) { session.setItem("dropdown1", "women"); console.log("success"); }
On Target page
import {session} from 'wix-storage'; // ... let value = session.getItem("text");//"women"
Sorry that I am very new to corvid and no idea how to run the code but keep trying now for the website.
Hope you may help ;) Appreciate so much!
@itsdjkcofficial Oh - for cryin' out loud - that's ridiculous! I hate it when I'm stupid. Answered a bit too quickly.
Two options:
You can use wix-storage. On the first page, save a value to identify the page using setItem(). Then on the target page that you are redirecting to, use getItem() to retrieve the identifier of the page that we came from.
The other was is to add a query to the URL when you redirect. The query will pass an identifier to the target page, and you can then retrieve the query using wix-location.query.
You can get the path of the referring page and then use that to change your dropdown.
See the docs on the text input's placeholder property.