Simple concept - InputField doing something when submitted

Hi guys. Quick question about using InputFields - how do you subscribe to an event when the field is submitted (enter is pressed) in another script to do something? The specific use case here is an Input Field that should append a text box with the inputted text when submitted, and clear itself. It also has to go through a script to append, as some parsing is done.

Cheers!

Hi, there is an onSubmit event on the InputField, it’s not in the inspector atm (bug) but you can access it via code until we fix this.

Hey Tim, yeah that was my first port of call but I can’t figure out what kind of code I need. Is it something like:
Inputfield.onSubmit += DoSomething();
and then:
void DoSomething()
{
}
Because that throws errors. What does the subscription look like?

Inputfield.onSubmit.AddListener(DoSomething);