Help forum

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

  • chr.foss

    1 year 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
  • Jay Campbell

    1 year 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

    1 year ago

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

    1 year 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
  • Jay Campbell

    1 year 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.
  • Jay Campbell

    1 year ago

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

    1 year 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
  • Jay Campbell

    1 year 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

    1 year ago

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

    1 year ago

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