Well the only reason I'm using a Zone update on the form is because I need to save new addrow data contained within a popup box to the user session and then reload the form with select menus containing the addrow data. When I use to submit the request without using the zone update, the page would just reloaded using the update page, it would set the page scroll to the top of the page rather than just staying static when the popup box closed out. That destroyed the UX completely.
The Zone update resolves the UX, however comes with the above side effects. The code. Create.class @Property private boolean newObject; void onActivate() { newObject = true; } Component.class @SessionState private ObjectState objectState; @Parameter private boolean newObject; private boolean newObjectUpdate; void onPrepareForRender() { if(newObject && !newObjectUpdate) { objectState.setObject(new Object()); } } @OnEvent(value = EventConstants.SELECTED, component = "update") Object updateObjectRequest() { objectState.setObject(getObject()); newObjectUpdate = true; return formZone.getBody(); } @CommitAfter @OnEvent(value = EventConstants.SELECTED, component = "commit") Object commitObjectRequest() { Session newSession = sessionSource.getSessionFactory().openSession(); Transaction tx = null; try { tx = newSession.beginTransaction(); newSession.saveOrUpdate(getObject()); update.setObject(getObject()); tx.commit(); } catch (Exception e) { if (tx != null) { tx.rollback(); } throw e; } finally { newSession.close(); } return update; } public Object getObject() { return objectState.getObject(); } Update.class public void setObject(Object object) { this.object= object; } Class<?> onActivate(Object object) { if(object!= null) { this.object= object; } else { return Index.class; } return null; } Object onPassivate() { Object value = null; if (object != null) { value = object.getId(); } return value; } void setupRender() { if((objectState.getObject() == null) || (object != null && !object .getId().equals(objectState.getObjectt().getId()))) { objectState.setObject(object); } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Saving-using-form-zone-tp4639355p4639665.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org