Working on a login form. What's the best way to pass form data to function?

0 favourites
  • 4 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hi

    I'm working to integrate some login/registration form, the login is done this way.

    As you can see I have to pick each Input object to get the text, put the value in a local variable and pass it to the JS function.

    Now I have to work with the Registration Form that has more fields. Is there a better way to do this?

    Thanks.

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I would give each TextInput a unique name so you don't have to pick them individually.

    then you should be able to bypass the need for local variables and just reference the relevant fields...

    Email.Text, Password.Text, etc...

  • I would give each TextInput a unique name so you don't have to pick them individually.

    then you should be able to bypass the need for local variables and just reference the relevant fields...

    Email.Text, Password.Text, etc...

    Why I didn't thought about that!

    Thanks!

    Edit:

    For doing this I would need a different Object for each TextInput right? Not only different instances.

  • correct.

    I guess if you really, really didn't want add objects for each field, you could reference the TextInput by instance:

    TextInput(0).Text, TextInput(1).Text, etc...

    but that assumes you know the order you added the instances to the layout, is not easy to read later, and is just asking for trouble.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)