Jorg,

On 23 Sep 2004, at 16:46, Jorg Heymans wrote:

My form has a multivaluewidget, it's values are retrieved from an Arraylist in the bean that is populated using Hibernate. The user then selects a few values and presses "next".
Now i would like to save these selected values into a different arraylist then the one where the values are retrieved from. Rationale: i don't want to destroy the original dataset because it's quite expensive to retrieve.


Is changing the setter method for the Arraylist the only option here? Or can i somehow in my javascript binding say "save the collection into a different location in the bean" ?

Maybe I am missing something, but can't you just retrieve from one location using the <fb:load-form/> and then save to a different (or both) locations in the <fb:save-form/> element? Like this:


        <fb:javascript id="projects" path="." direction="save">
                <fb:load-form>
                        // do normal load binding here
                </fb:load-form>
                <fb:save-form>
                        var user = jxpathPointer.getNode();
                        
                        var values = new Packages.java.util.ArrayList();
                        values = widget.getValue();
                        user.setLocationOne(values); // Set to first location
                        user.setLocationTwo(values); // Set to second location
                </fb:save-form>
        </fb:javascript>

Notice that the path attribute of the fb:javascript element is set to ".", so you can access all properties of your bean and so save to multiple locations.

That is of course if you are using a custom javascript binding. If you are using plain value binding then you can just set the direction attribute to "save" or "load" on your binding elements.

Of course you need to perform the binding in your flow or wherever after the user presses "next".

Robin


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to