-
1. Re: Changes in some form field are immediately persisted to the database
cardel.ka.jelinek.seznam.cz Jun 1, 2008 7:21 AM (in response to cardel.ka.jelinek.seznam.cz)Here is part of my view
<a:outputPanel id="IPPanel" rendered="#{s:hasRole('admin') and user.role eq 'reseller'}"> <s:decorate> <h:inputText id="IPInput" value="#{user.ip}" styleClass="text"> <a:support event="onblur" reRender="IPPanel" ajaxSingle="true" /> </h:inputText> <h:message for="IPInput" errorClass="error" /> </s:decorate> </a:outputPanel>
-
2. Re: Changes in some form field are immediately persisted to the database
pmuir Jun 2, 2008 12:23 PM (in response to cardel.ka.jelinek.seznam.cz)Try using bypassUpdates="true" on <a:support />
-
3. Re: Changes in some form field are immediately persisted to the database
cardel.ka.jelinek.seznam.cz Jun 2, 2008 1:29 PM (in response to cardel.ka.jelinek.seznam.cz)Yes, thanks... It solved problem with database update, but It caused another one problem. When I now remove some value from field which is not required and go to another field, the old value from previous field will appear.
For example:
I have some IP address in IPInput field. I will delete it. I go to antoher field. And old value of IP address will appear in the IPInput field. So I cant now delete fields which are not required, I can only change values. -
4. Re: Changes in some form field are immediately persisted to the database
cpopetz Jun 2, 2008 3:03 PM (in response to cardel.ka.jelinek.seznam.cz)How are you injecting your persistence context? Is it a seam-managed persistence context? Is this is long running conversation? Is
user
an entity? An ejb session bean? Is it a seam component, and if so, is it annotated with @Transactional? -
5. Re: Changes in some form field are immediately persisted to the database
cardel.ka.jelinek.seznam.cz Jun 2, 2008 4:04 PM (in response to cardel.ka.jelinek.seznam.cz)A User is an entity bean. I am not using ejbs. And user is updated via UserHome object.
@Name("userHome") public class UserHome extends EntityHome<User> { @In private EntityManager entityManager; }
I have entityManager defined in my components.xml file as:
<persistence:managed-persistence-context name="entityManager" auto-create="true" entity-manager-factory="#{hcpEntityManagerFactory}"/> <persistence:entity-manager-factory name="hcpEntityManagerFactory" persistence-unit-name="hcp"/>
and for update I am calling userHome.update() method which is not overrided. So it is marked as @Transactional.
It is not long running converastion.
But old value in field after deletion will appear after leaving this field. I am not calling some of my methods. It is caused with AJAX a:support component.
-
6. Re: Changes in some form field are immediately persisted to the database
cpopetz Jun 2, 2008 5:40 PM (in response to cardel.ka.jelinek.seznam.cz)If you haven't begun a long running conversation, your userHome component has been destroyed after rendering the initial repsonse. Thus, on each ajax submission, you are re-creating it, re-loading the entity from the database, and hence your field values aren't living beyond each ajax request/response.
-
7. Re: Changes in some form field are immediately persisted to the database
cardel.ka.jelinek.seznam.cz Jun 5, 2008 1:30 PM (in response to cardel.ka.jelinek.seznam.cz)I have tried to start long running converastion before rendering view with my form. Conversation starts, I have my userHome object in its context but with no effect. If I clear field, which is not required its old value will appear.
Everithing works fine, when I remove a:support tags from page, but all fields are validated after user submit form. I wanted to do validation immediately on blur action on field.