In the previous chapter, when we wrote the userSignUpForm
class, we handled all the fields individually. It requires a lot of coding to add the fields individually on the layout, to gather the data from the fields individually before sending the data to the server, and so on. In this chapter, we have already used the form and the features such as renderer, resetter, and validator in the Time for action enhancing the UserSignUpForm section.
1. Let's use the form controller now to gather the data generically from all the fields in the form and send the data to the server through an RPC call.
In the
UserSignUpForm.js
class, update the register button's executing listener, after the validation is completed successfully:var controller = new qx.data.controller.Form(null, form); var model = controller.createModel(); var user = qx.lang.Json.parse(qx.util.Serializer.toJson(model));
2. Now, let's perform the user registration call to the server...