bruno       2003/06/26 06:40:28

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/formmodel
                        Repeater.java
  Log:
  appropriately add or remove rows on repeater submit as required.
  
  Revision  Changes    Path
  1.5       +11 -4     
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Repeater.java
  
  Index: Repeater.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Repeater.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Repeater.java     26 Jun 2003 09:15:04 -0000      1.4
  +++ Repeater.java     26 Jun 2003 13:40:28 -0000      1.5
  @@ -129,10 +129,17 @@
               } catch (NumberFormatException exc) {
                   // do nothing
               }
  -            for (int i = 0; i < size; i++) {
  -                // TODO: a person with bad intents could pass a very large size 
parameter, maybe we should
  -                // check for a built-in limit or something.
  -                addRow();
  +            int currentSize = getSize();
  +            if (currentSize < size) {
  +                for (int i = currentSize; i < size; i++) {
  +                    // TODO: a person with bad intents could pass a very large size 
parameter, maybe we should
  +                    // check for a built-in limit or something.
  +                    addRow();
  +                }
  +            } else if (currentSize > size) {
  +                for (int i = currentSize - 1; i >= size; i--) {
  +                    removeRow(i);
  +                }
               }
           } else {
               rows.clear();
  
  
  

Reply via email to