Text Input for PlayCanvas UI

The library has UiInputField.value which is the property that should be used to read the value: https://playcanvas.com/editor/code/1005906?tabs=109692056

The HTML input field should not be used to read the value of the text field.

Oh, you are talking about while you are typing, the value is still the old value. In which case, this library doesn’t support that. It only gets the value of input box when the user is done.

No i was talking exactly about the “value” property and building an example on tutorial project i saw that it works as expected, so I have to understand why in my project it doesnt set the value on Unfocus, to be continued :smiley: thank you

I noticed that the input field does not resize when resizing the browser to a larger size. Any way to fix this?

v1.5

  • Fixed resize bug on desktop where it would change to mobile input style when window was resized
1 Like

A post was split to a new topic: How do I add text for instructions in FPS tutorial?

How can i access this value propery from the script?
This does not work…
password = this.app.root.findByName(‘PasswordInputField’);
console.log(password.value);

findByName returns an entity. So from there, you need to access the script component and then the script type and finally the property for the text

I’m not at a computer so untested:

const passwordEntity = this.app.root.findByName(‘PasswordInputField’);
passwordEntity.script.uiInputField.value

Thank you! It works.

Is there a way to make a tab-sequence in a Layout Group?
After i enter a username and enter/tab - the cursor does not proceed to the next InputField passwort and then next to buttonLogin.

No, you will have to code that yourself