Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form get input data

 
naro pad
Ranch Hand
Posts: 58
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am have just started my first javafx application and I have the following easy issue:

I have the following javafx fxml file


Now I want to bind this 4 fields to an object and use this object on the fxml controller class to pass the data entered on the form into the database .I have tried to find related examples on the Internet but without any luck. Can anyone help me.
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to define a controller class. Either by telling the classname in the fxml file or in the loader of your fxml file.
You might want to read fxml manual and fxml tutorial.
If you have any questions don't hesitate to ask.
 
naro pad
Ranch Hand
Posts: 58
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already created my controller class. My problem is how to bind the controls to the object properties.
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could add an onAction="#onTextChanged" to your TextFields like this:

and implement those in your controller like:

or you could add the controlls to your controller and add the listener afterwards like:


remember that the field name and the id always needs to be the same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic