Author Topic: Verry simple question about basic inputfield  (Read 2493 times)

curzon

  • Guest
Verry simple question about basic inputfield
« on: October 16, 2012, 12:03:56 PM »
Hi folks, got a NGUI professional version and working through the tutorials right now. First of all: its a VERRY good Framework that is easy to use.

I'm trying now to script around with NGUI, but i just can't find the answer to my question:

I have created a UI named "LoginGui"...
this UI (LoginGui->Camera->Anchor->Panel->....) have got 2 Inputfields named "InputAccount" and "InputPassword" and 1 Button...
a button got a OnClick() function and I want to get the variables of these 2 Input fields (in JavaScript) by pressing the button.

How can I do this? A simple code snippet would be nice how to access this variables of the Imputfields...
Thank you very much in advance for your answer
« Last Edit: October 16, 2012, 12:06:20 PM by curzon »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Verry simple question about basic inputfield
« Reply #1 on: October 16, 2012, 01:15:58 PM »
1. Create public variables on your button script -- inputUsername, inputPassword.
2. Attach this script to your button
3. Drag & drop the inputs into these fields in the inspector
4. Add an OnClick() function to this script that will do something. You can retrieve values by using inputUsername.text, etc.