How can I get the variable values from a component?

Hello community,

I created a component with two inputs in my app on WeWeb, and I am using this component on two different pages.

I am facing a problem where I cannot access the values of the inputs from outside the component. For example, when I submit the form, the workflow does not have access to the inputs inside the component.

I started by trying to create two component variables, one for each input, and linked them to the respective “Init value” and checked the option to make them visible outside the component (Expose value outside the component). However, even though I can see the variables in the workflow, they remain undefined even with values filled in the inputs.

Does anyone know how to solve this problem?

1 Like

Hey there,
I think that you need to create a workflow on your input with the onChange trigger. Each time the value of the input changes, you want to update your new variable (because that’s the one that is exposed outside).

I’m pretty sure this is a bug. I fiddled for ages on the same issue.

On my side the variables show up in the LH logs menu, but they are not visible outside of the component.

What eventually worked for me is:
Inside the component, edit the variables and “resave” them. Then they are available for use outside the component again. until you refresh your page.