cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Re: XML Form use cases
Date Sun, 15 Jun 2003 13:20:40 GMT

On Thursday, April 17, 2003, at 01:31 PM, Johan Stuyts wrote:

<snip/>

> Use case B: A button per item
> ----------
> A lot of forms contain lists. It is handy to add one or more buttons to
> each item sometimes. (e.g. a 'delete' button for each item in a 
> shopping
> cart)

<snip/>

I am trying to add an 'edit' action to each member of a Set of child 
objects on a Bean I am working on with JXForms.

public class Coverage extends PersistableBean {
	private String name;
	private String description;
	private Coverage parent;
	private Set children; // this one wants a list of edit buttons

The action needs to be submitted, to the 'forward' continuation.

The Flowscript function looks like this:
(the 'exit', 'save' and 'editParent' commands are working)

function editCoverage (xform, reg) {
   while (true) {						// event handling loop
     xform.sendView ("/coverage/edit.xml");
     var coverage = xform.getModel();
     var command = xform.getSubmitId();
     if (command == "exit") {
       break;						// don't save, exit
     } else if (command == "save") {
       reg.saveCoverage(coverage);		// save and carry on
     } else if (command == "editParent") {
       xform.setModel(coverage.getParent()); // switch to parent
       editCoverage(xform, reg);		// recurses, calls sendView()
       xform.setModel(coverage);		// now back to child
     } else if (command == "editChild") {
       var child; 						// get child ???????? how?
       xform.setModel(child);			// switch to child
       editCoverage(xform, reg); 		// recurses, calls sendView()
       xform.setModel(coverage);		// now back to parent
     } else if (command == "newChild") {
       newChildCoverage(xform, reg);	// calls sendView()
     } else if (command == "delete") {
       deleteCoverage(xform, reg);		// calls sendView()
    } else if (command == "move") {
       moveCoverage(xform, reg);		// calls sendView()
    }
     if (coverage == null) break;
     if (reg = null) {
       xform.sendView ("/coverage/fatal.xml");
       break;
     }
   }
}

Has anybody got any ideas how you would identify which child's edit 
button was pressed?



Thanks for any feedback.

regards Jeremy





Mime
View raw message