PricingBlog

hidden variables in toddle

  • prettycold_-1277217593056297011

    Sam B

    1 year ago

    Probably a toddle newbie question. I'm trying to pass values from one page to another. Can variables be used for this? I'm guessing no as the scope doesn't seem to be that. Attributes seem to be a good fit, but not quite sure how. What'd be the most common way of doing this?

    Here's the scenario, if the user clicks on Button A, I need to send the value "red" and if the user clicks on Button B, I need to send the value "blue". On the second page, I have a few input fields and on form submit, along with the input fields I also need to send "red" or "blue" as the case may be to the API. That in turn stores the data in Xano.
  • tomthebigtree-1277246481874817106

    Tom Ireland

    1 year ago

    You could use query parameters in the URL as one way to do it. Alternatively, using session/local storage (a common approach when implementing something like light/dark mode) would work. If it's something that should be remembered the next time a user logs in e.g. completion of a profile, etc., that's behind authentication, probably best to store that in the database and retrieve that when the user logs in. Does that help?
  • prettycold_-1277298384407105771

    Sam B

    1 year ago

    Perfect, thanks a lot @Tom Ireland
    👍1
  • Tod-1277298385765793917

    Tod

    1 year ago

    Great energy @Sam B! Your continuous contribution to the toddle Community just made you advance to Community Level 2!