How to get the value of a text input within the component?

I’m probably missing something simple here…I have a text input field whose input is bound to a formula (so I can’t use two-way binding), and I’m trying to access its value from within the component so I can send it to an Output variable, but I haven’t been able to get the value of the actual text in the input.

I’ve tried using self.value and internalProperties.value, but they both return empty (when using an Alert on the onChange event.) How can I get that value so I can set it to an output variable?

Input component with properties:

Isolation view:

Component properties:

Any help would be much appreciated!

Not a direct answer, but if multiple things want to know this value, I’d pull it out of the component and make it a page variable so many things on the page can use it. Add a “set page variable” flow step to your page logic and set the page variable using the formula there (after hide spinner). Then many things can access the value, including your input box.

Thanks for the suggestion, but I’m not sure I can do it in my situation. The input field I’m using is in a Repeat based on a configuration file, so I can’t really have app/page vars for each one without hardcoding them, which I was hoping to avoid as it will defeat the purpose of the config file.

Any ideas here, folks? Seems like something that should be possible…


We had a lengthy conversation about this topic, and came to the result that there’s no way of doing what you want to be done right now (unless you take the page variable approach explained above). Basically you’d need to make the bindings in the input primitive one-way, which isn’t possible.

We are planning to add support for (some) formulas to be two-way bindable, so that would solve this for you, but that support isn’t there yet, and we don’t have an estimate for when it would be available as of now.

Thanks for raising this issue!

Thanks for letting me know, @Mevi. Good to know I’m not just being dumb here…heh. I did end up hard-coding these to app vars which is ugly, but works for now.

However, it was even uglier than I expected - is there a way to bind a component value to the name of a var by reference? I would like to store the name of the var in my config file only, so I can then just call it in my Repeat, but I couldn’t figure out how, so I had to hard-code multiple inputs into the repeat and show/hide based on the name, but that means truly hard-coding data into the display which is pretty ugly. If I could pull the name from the Repeated item and use it to bind to an app var, that would be ideal. Is there a way to do that?

Thanks again!

Hi! Unfortunately I don’t think there’s any way to dynamically reference an app/page variable, nor will there be as it would wreck a lot of the optimizing we do to make apps run as fast as possible. So you’ll have to go with the hard-coding for now. The two-way bindable formulas are still a while away, I’m told we’ll be getting them in 2.7.X the earliest.

If I understand your problem statement correctly, what you need to do is going be convoluted, but, I think, that’s what I am doing, maybe.

I assume you want to trigger this external value being populated into an input field of a composite component on some event, i.e. component mounted, or onChange, or onFocus, or onBlur.

  1. Inside this component you have an input field and you can add a property “Value”
  2. When you highlight the entire component, it should list “Value” and give you the option for 2-way binding.
  3. You’d want to declare trigger events, with appropriate names to correspond to tap, focus, blur, change, etc… Once you declare these new events inside the composite component, you could attach them now to their internal counterparts, so that every time some internal event fires, it also causes the ones you have declared to fire.
  4. The events you have declared internally to the component are now visible at the level of the entire component, and they can trigger other logic.