Re: Issues with beaneditform component
On Wed, 26 Nov 2014 23:44:58 -0200, Name Surname wrote: @CommitAfter public String OnSuccess() { logic.editUser(user); return "ListClassesPage"; } I'm not sure it matters, but try onSuccess(), without capitalizing the first letter. Now after I press Save, it fires event however doesn't process anything? What do you mean by "doesn't process anything"? Is the event handler method invoked? http://stackoverflow.com/questions/5366498/tapestry-5-beaneditform-component-trouble I had to remove all constructors from entity User but default one. You didn't need that. All you needed, and there's an answer telling you that, is a void onPrepare() { if (user == null) { user = new User(); } } -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: Issues with beaneditform component
Nope. Implementation is fair OK to me. Checked console and there is nothing and I mean nothing on screen when I press Submit. It's like I didn't press anything??? > Date: Thu, 27 Nov 2014 22:48:14 +1100 > Subject: RE: Issues with beaneditform component > From: ch...@opencsta.org > To: users@tapestry.apache.org > > Dunno - I use the param user in onActivate instead of setData. Also just > int. > > During @setupRender stage, fetch from logic the orig. > > At save time, my logic sets it all from form object. > > Make sense?
RE: Issues with beaneditform component
Dunno - I use the param user in onActivate instead of setData. Also just int. During @setupRender stage, fetch from logic the orig. At save time, my logic sets it all from form object. Make sense?
RE: Issues with beaneditform component
Hello Chris! Well the thing is I used @persist just for that purpose, to save me from using the stale user object. There is some other issue around here which at this stage I can't figure out. :/ > Date: Thu, 27 Nov 2014 13:04:56 +1100 > Subject: Re: Issues with beaneditform component > From: ch...@opencsta.org > To: users@tapestry.apache.org > > On permission page I dont think u need @persist, you are setting the user > already. > > The reason: I think its because when it goes to save it is using the stale > user object discarding the form submission changes. > On 27/11/2014 12:45 pm, "Name Surname" wrote: > > > I have one very odd situation here and it regards beaneditform. I have > > implemented following code: > > > > > > public class ListUsers { > > > > @Inject > > private Logic logic; > > > > @InjectPage > > private PermissionsPage permissionsPage; > > > > > > @Property > > private User user; > > > > /** > > * Vraca listu korisnika > > * @return user list > > */ > > public List getUsers() > > { > > return logic.izlistajSveKorisnike(); > > } > > > > /** > > * Deletes user > > * @return null > > */ > > @CommitAfter > > public String onActionFromDelete(User u) > > { > > logic.deleteUser(u); > > return null; > > } > > > > /** > > * redirects to permissions page > > * @param k > > * @return page permissionspage > > */ > > public Object onActionFromEdit(User u) > > { > > permissionsPage.setData(u); > > return permissionsPage; > > } > > > > http://tapestry.apache.org/schema/tapestry_5_3.xsd"; > > xmlns:p="tapestry:parameter"> > > > > > > > exclude="userID,userPassword,userTypeOfTheUser,listOfQuestions,listOfMessages, > > isAdmin, isUser" add="edit,delete"> > > > > > > Delete > > user > > > > > > Edit > > permissions > > > > > > > > > > > > > > > > > > Here I have a ListUsers page which has all users listed pulled from DB. > > > > > > Now when a client clicks on Edit permissions button of some user from the > > list it redirects him to a PermissionsPage which is following: > > > > http://tapestry.apache.org/schema/tapestry_5_3.xsd";> > > > exclude="userUserName,userPassword" submitlabel="Save"/> > > > > > > public class PermissionsPage { > > > > @Component > > private BeanEditForm form; > > @Inject > > private Logic logic; > > @Property > > @Persist(value = "flash") > > private User user; > > > > /** > > * After succesfully submitting from a form redirect a user to a page > > * ListClassesPage > > * > > * @return ListClassesPage > > */ > > @CommitAfter > > public String OnSuccess() { > > logic.editUser(user); > > return "ListClassesPage"; > > } > > > > /** > > * Sets user > > * @param u user > > */ > > public void setData(User u) { > > user = u; > > } > > } > > > > > > > > Now after I press Save, it fires event however doesn't process anything? > > Am I somewhere wrong? > > Also because of the issue regarding > > http://stackoverflow.com/questions/5366498/tapestry-5-beaneditform-component-trouble > > I had to remove all constructors from entity User but default one. If > > anyone knows or had similar trouble with this, would be grateful to hear > > his/her solution. > > > > Thanks in advance. > > > >
Re: Issues with beaneditform component
On permission page I dont think u need @persist, you are setting the user already. The reason: I think its because when it goes to save it is using the stale user object discarding the form submission changes. On 27/11/2014 12:45 pm, "Name Surname" wrote: > I have one very odd situation here and it regards beaneditform. I have > implemented following code: > > > public class ListUsers { > > @Inject > private Logic logic; > > @InjectPage > private PermissionsPage permissionsPage; > > > @Property > private User user; > > /** > * Vraca listu korisnika > * @return user list > */ > public List getUsers() > { > return logic.izlistajSveKorisnike(); > } > > /** > * Deletes user > * @return null > */ > @CommitAfter > public String onActionFromDelete(User u) > { > logic.deleteUser(u); > return null; > } > > /** > * redirects to permissions page > * @param k > * @return page permissionspage > */ > public Object onActionFromEdit(User u) > { > permissionsPage.setData(u); > return permissionsPage; > } > > http://tapestry.apache.org/schema/tapestry_5_3.xsd"; > xmlns:p="tapestry:parameter"> > > > exclude="userID,userPassword,userTypeOfTheUser,listOfQuestions,listOfMessages, > isAdmin, isUser" add="edit,delete"> > > > Delete > user > > > Edit > permissions > > > > > > > > > Here I have a ListUsers page which has all users listed pulled from DB. > > > Now when a client clicks on Edit permissions button of some user from the > list it redirects him to a PermissionsPage which is following: > > http://tapestry.apache.org/schema/tapestry_5_3.xsd";> > exclude="userUserName,userPassword" submitlabel="Save"/> > > > public class PermissionsPage { > > @Component > private BeanEditForm form; > @Inject > private Logic logic; > @Property > @Persist(value = "flash") > private User user; > > /** > * After succesfully submitting from a form redirect a user to a page > * ListClassesPage > * > * @return ListClassesPage > */ > @CommitAfter > public String OnSuccess() { > logic.editUser(user); > return "ListClassesPage"; > } > > /** > * Sets user > * @param u user > */ > public void setData(User u) { > user = u; > } > } > > > > Now after I press Save, it fires event however doesn't process anything? > Am I somewhere wrong? > Also because of the issue regarding > http://stackoverflow.com/questions/5366498/tapestry-5-beaneditform-component-trouble > I had to remove all constructors from entity User but default one. If > anyone knows or had similar trouble with this, would be grateful to hear > his/her solution. > > Thanks in advance. > >