Pricing Blog

Can't set input value (event > current > value missing)

  • chr.foss-1391545765763219496

    chr.foss

    5 days ago

    In my login form I'm using custom input components, but I can't seem to get the component working.

    In the input component I have a label and a standard input, but when I try to set my value I select the value of the input event, just the event itself.
    Quite sure this is the issue but I can't find the solution.

    What am I missing?
    1391545766220140597-image.png
    1391545766555680848-image.png
    1
  • jaycmpb-1391548714652536884

    Jay Campbell

    5 days ago

    Are you sure you’re triggering that event on the input and change events in your input element in the component?

    You want to pass the event.target.value to your event.
  • Tod-1391548716770525244

    Tod

    5 days ago

    Great job @Jay Campbell! Your contribution to the Nordcraft Community just made you advance to Community Level 6! 🌲
    🔥1
  • chr.foss-1391551628414287953

    chr.foss

    5 days ago

    So structure goes like this

    -Form component
    -- UI Input & label component
    --- Input component

    On the input I'm fetching the event.target.value.
    I have an input event on the input to store that value in an inputValue variable.

    In the UI input & label component I'm taking that and setting another variable (value) and already here I can't get the event value.

    Not sure how I'd pass the value to my event?

    PS. Amazing reply time, thanks so much for being on fire!
    1391551627982540800-image.png
    1391551628334858250-image.png
  • jaycmpb-1391553574294786088

    Jay Campbell

    5 days ago

    On your ui-input you need an event to send the data out of the component, not set it to a value. Create an event called “onValueChange(or something similar) on your ui-input and have that be triggered by both the change and input events in the inputs section of the events tab, set to event.target.value.

    Then in your ui-input-label create the same event and have this event triggered by the onValueChange event on your ui-input set to just the value of the event.

    Now you should be able to get the value of the input from outside the ui-input-label component.
  • jaycmpb-1391553848006672425

    Jay Campbell

    5 days ago

    I can help better via call if needed. 😎
  • chr.foss-1391554805343715491

    chr.foss

    5 days ago

    Aaahhh! Events send the data out, that makes sense.

    I’ll give it s go tomorrow, 1am here 😴

    Cheers and thanks for the offer 🤍
    🔥1
  • jaycmpb-1391555951210791045

    Jay Campbell

    5 days ago

    I also have a video on it here where you also open the project and see it for yourself:

    https://youtu.be/BrVK0OPX0ks?si=BmgcsJ4zCuMHW20b
    🤘1
  • chr.foss-1391745304147132518

    chr.foss

    4 days ago

    You're the champ, Jay - got it working like a charm!
    🔥1
  • Tod-1391745305539514430

    Tod

    4 days ago

    Great job @! Your contribution to the Nordcraft Community just made you advance to Community Level 2! 🌲