Get data for form from database [message #1817346] |
Wed, 20 November 2019 12:34  |
Eclipse User |
|
|
|
Hi
I'am currently trying to display some user data. For this I set up a UserTablePage, a UserNodePage and a UserForm.
The UserTablePage obviously shows all users in a table. For every user a child page of type UserNodePage is created. The node pages only content is the UserForm, which should display more details than the table.
Everything works fine, except the UserForm. The load() in the UserService looks like this:
public UserFormData load(UserFormData formData) {
String sql = ""
+ "SELECT name "
+ "FROM user_account "
+ "WHERE token = ??? "
+ "INTO :name";
SQL.selectInto(sql, formData);
return formData;
}
This does not work, since I don't know how to get information about the user I'm trying to get data for (the ??? in the query).
I figured I can give the UserNodePage the needed information with this setter/getter:
@FormData
public String getToken() {
return token;
}
@FormData
public void setToken(String token) {
this.token = token;
}
But how can I pass this information to the UserForm?
Some additional information:
To immediatly view the UserForm, I added a ViewHandler:
public class ViewHandler extends AbstractFormHandler {
@Override
protected void execLoad() {
IUserService service = BEANS.get(IUserService.class);
UserFormData formData = new UserFormData();
exportFormData(formData);
formData = service.load(formData);
importFormData(formData);
setEnabledPermission(new UpdateUserPermission());
}
}
The handler gets called in the UserForms constructor:
public UserForm() {
setHandler(new ViewHandler());
}
Best regards and thanks for your help in advance
yannek
|
|
|
|
|
|
|
Re: Get data for form from database [message #1851200 is a reply to message #1817346] |
Wed, 30 March 2022 08:41  |
Eclipse User |
|
|
|
Try to see the content of your UserTablePage, UserNodePage, and for your UserForm. Look if there are any mistakes that you oversaw. What are the errors on display? I have a different way of categorizing the data. Last time SALVAGEDATA restored it after a stupid mistake. Don't exhaust the program with too many commands, especially if they are not clear, they can put the whole information in danger. I like the advice Andre gave you. Go to the section "adding form fields", and from there follow every step in detail. Send us some pics if nothing changes.
[Updated on: Fri, 01 April 2022 18:54] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05053 seconds