i have a form that contains several text fields and a 'register' button.
when the register button is pressed i want to send the contents of the fields to a web svc.
I have successfully connected to my webservice and passed hardcoded post variables.
I am having trouble getting the proper syntax to addArgument to pass the contents of the text fields.
For example, if I have a form (Register) and on that form i have a text field (txtFirstName),
what is the syntax to add the contents of the txtFirstName field to the addArgument command?
My code follows:
@Override
protected void onRegister_BtnRegisterAction(Component c, ActionEvent event) {
// register new user
ConnectionRequest r = new ConnectionRequest();
r.setUrl("http://localhost/ihsnj/websvc.php");
r.setPost(true);
r.addArgument("R", "Y"); // R = register
// this is the line generating the error <cannot find symbol>
r.addArgument("FirstName",txtFirstName.getText());
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
r.setDisposeOnCompletion(dlg);
NetworkManager.getInstance().addToQueueAndWait(r);
}
Your problem isn't related to ConnectionRequest. You need to use find methods not fields since components are only constructed when the form is actually showing (to preserve RAM).
Use findTxtFirstName(c).getText()
as the second argument e.g.:
req.addArgument("first_name", findTxtFirstName(c).getText());
i have a form that contains several text fields and a 'register' button.
when the register button is pressed i want to send the contents of the fields to a web svc.
I have successfully connected to my webservice and passed hardcoded post variables.
I am having trouble getting the proper syntax to addArgument to pass the contents of the text fields.
For example, if I have a form (Register) and on that form i have a text field (txtFirstName),
what is the syntax to add the contents of the txtFirstName field to the addArgument command?
My code follows:
@Override
protected void onRegister_BtnRegisterAction(Component c, ActionEvent event) {
// register new user
ConnectionRequest r = new ConnectionRequest();
r.setUrl("http://localhost/ihsnj/websvc.php");
r.setPost(true);
r.addArgument("R", "Y"); // R = register
// this is the line generating the error <cannot find symbol>
r.addArgument("FirstName",txtFirstName.getText());
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
r.setDisposeOnCompletion(dlg);
NetworkManager.getInstance().addToQueueAndWait(r);
}
Your problem isn't related to ConnectionRequest. You need to use find methods not fields since components are only constructed when the form is actually showing (to preserve RAM).
Use findTxtFirstName(c).getText()
as the second argument e.g.:
req.addArgument("first_name", findTxtFirstName(c).getText());
0 commentaires:
Enregistrer un commentaire