Results 1 to 5 of 5

Thread: Form Resetting SWF-2.0M4

  1. #1
    Join Date
    Feb 2008
    Posts
    29

    Default Form Resetting SWF-2.0M4

    Hello Spring Web Flow community,


    I'm already using SWF 2.0 for a project were I'm facing the following situation:

    On a form I need to insert values inside a table while providing information on a regular form. The problem is that when I call the view with the other form (using "popup=true" or not) and I come back to the previous form the information that I provided so far is not there. Every time I close a popup the whole page gets refresh (I'm using fragments).

    This code should help understanding this problem:

    Code:
        <view-state id="edit">
            ...
            <transition on="create" to="editRegion">
                <evaluate expression="regionService.createRegion()" result="flowScope.selectedRegion" />
            </transition>
        </view-state>
    
    	<view-state id="editRegion" popup="true">
    		<on-entry>
    			<render fragments="fragmentEditRegion"/>
    		</on-entry>
    		<transition on="save" to="edit" >
    			<evaluate expression="selectedTown.regions.add(selectedRegion)" />
    		</transition>
    		<transition on="cancel" to="edit" />
    	</view-state>
    The "create" transition is defined on "edit.xhtml" using the following code ("..." means code not related to the problem and striped away).

    Code:
    <ui:fragment id="fragmentoListaRegioes">
    ...
    <sf:commandLink id="create" processIds="fragmentRegionList" value="new" action="create" />
    ...
    </ui:fragment>
    Is this an issue on the development version of SWF or I'm doing something wrong?


    Thanks in advance,
    Pedro Casagrande de Campos

  2. #2
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    Is the regular form a child of fragmentRegionList? Sounds to me like those values are not being submitted, and thus not being saved. You could add the form to the list of processIds, or else use processIds="*", but that could get tricky if you've got validation on the form and the form is only partially filled out.

    Sounds like what you really want is to be able to submit and close the popup with another Ajax request, and refresh only a section of the original form, correct? Right now you aren't able to do that because of a bug that I'm currently working, but hopefully I'll have a solution soon.

    -Jeremy

  3. #3
    Join Date
    Feb 2008
    Posts
    29

    Default

    Thanks for the quick answer Jeremy.

    Actually the whole form is inside a fragment, but I'm using only the table fragment as the fragmentIds of the sub state. By providing the form fragment on the commandLink I can retain the form value as I desire, but the fields' validation prevents the popup from showing, as you've said. I will wait the for this issue to be solved then.

    I'm finding M4 flow definition better to describe than the 1.0 ones, but I'm still having issue with the fragments, getting the following exception:

    java.lang.IllegalArgumentException: Component to be rendered with id 'selectedRegion:region:0:edit' could not be found.

  4. #4
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    Quote Originally Posted by pccampos View Post
    I'm finding M4 flow definition better to describe than the 1.0 ones, but I'm still having issue with the fragments, getting the following exception:

    java.lang.IllegalArgumentException: Component to be rendered with id 'selectedRegion:region:0:edit' could not be found.
    What JSF implementation and version are you using? MyFaces 1.2.0 had some problems (basically parts of the 1.2 spec that hadn't been properly implemented yet) that kept our Ajax controls from working in a dataTable. 1.2.2 fixed the issue.

    - Jeremy

  5. #5
    Join Date
    Feb 2008
    Posts
    29

    Default

    I think I was using an older version of MyFaces. I've it updated and it stated to work. Some of my tables was using direct JPA list (java.util.List), so I had to encapsulate it on a OneSelectionTrackingListDataModel. I've done this using the following tag on the flow:

    <evaluate expression="selectedTown.getRegions()" result="flowScope.regions" result-type="dataModel"/>

    Pedro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •