Announcement Announcement Module
Collapse
No announcement yet.
Losing form data on transition with Spring Webflow2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Losing form data on transition with Spring Webflow2

    I am losing my form data on transition. I am using Spring with WebFlow2 two and my user starts to enter data but as the user is entering data if he clicks on one of the radio buttons like the onces below I need to load a list of schools based on the radio buttons. So I am using Javascript to kick off the transition but once I go back to the view I lose all the other data. Can someone please tell me what I am losing my form data on transition.

    Thanks

    My flow:

    Code:
    <view-state id="SchoolVisitReport" view="SchoolVisitReport.jsp" model="visit" >
           <transition on="submit" to="addVisit">
               <evaluate expression="flowActions.validateVisit(visit, messageContext)"/></transition>
           <transition on="loadSchools" to="SchoolVisitReport" >
            	<evaluate expression="flowActions.initializeSelectableSchools(visit)" result="flowScope.selectableSchools"/>
             </transition>
        <transition on="cancel" to="endState" bind="false"/>
        </view-state>
    My JavaScript on form:

    Code:
     <form:radiobutton tabIndex="9" onchange='window.location="${flowExecutionUrl}&_eventId=loadSchools"' onclick='window.location="${flowExecutionUrl}&_eventId=loadSchools"' value="B" path="borough" />Bronx-X<BR>
        						<form:radiobutton tabIndex="10" onchange='window.location="${flowExecutionUrl}&_eventId=loadSchools"' onclick='window.location="${flowExecutionUrl}&_eventId=loadSchools"'value="K" path="borough" />Kings-K<BR>

    so based on the above information I don't understand why my view would not have the form data in it.

  • #2
    Originally posted by JohnTheDroider View Post
    I am losing my form data on transition. I am using Spring with WebFlow2 two and my user starts to enter data but as the user is entering data if he clicks on one of the radio buttons like the onces below I need to load a list of schools based on the radio buttons. So I am using Javascript to kick off the transition but once I go back to the view I lose all the other data. Can someone please tell me what I am losing my form data on transition.

    Thanks

    My flow:

    Code:
    <view-state id="SchoolVisitReport" view="SchoolVisitReport.jsp" model="visit" >
           <transition on="submit" to="addVisit">
               <evaluate expression="flowActions.validateVisit(visit, messageContext)"/></transition>
           <transition on="loadSchools" to="SchoolVisitReport" >
            	<evaluate expression="flowActions.initializeSelectableSchools(visit)" result="flowScope.selectableSchools"/>
             </transition>
        <transition on="cancel" to="endState" bind="false"/>
        </view-state>
    My JavaScript on form:

    Code:
     <form:radiobutton tabIndex="9" onchange='window.location="${flowExecutionUrl}&_eventId=loadSchools"' onclick='window.location="${flowExecutionUrl}&_eventId=loadSchools"' value="B" path="borough" />Bronx-X<BR>
        						<form:radiobutton tabIndex="10" onchange='window.location="${flowExecutionUrl}&_eventId=loadSchools"' onclick='window.location="${flowExecutionUrl}&_eventId=loadSchools"'value="K" path="borough" />Kings-K<BR>

    so based on the above information I don't understand why my view would not have the form data in it.
    When you click on the radio button you're sending a GET request without form data therefore you lose the data.
    It would be easier to answer if I knew what 'flowActions.initializeSelectableSchools(visit)' is supposed to do.
    If you simply want to modify the content of let's say a combo box then there is no need to execute it as a transition. Just use javascript with ajax call to get update combo with new data.
    If however you do some logic with your data then you need to submit form data by appending it to the url.

    Comment

    Working...
    X