You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Lamvik Eldbjörg (Applikations-Entwicklerin)" <el...@mobi.ch> on 2006/06/06 10:29:25 UTC

How can I use the repeater add-row function with a normal button?

Hi, I am trying to implement a repeater widget, where extra rows are added when a button is clicked. I've set the repeater initial-size to "2", and when I load the form it shows the rows. I need to use a regular input button, not a submit button, because the onSubmit action is used for form validation. Does anybody know how to do this? Do I have to add an onClick event and if yes, what value should it have? I'm really stuck here, so help is very much appreciated!

Kind regards,
Ellie
(Cocoon Version: 2.1.7)

### form definition: ###

<fd:repeater id="m54_sachen" initial-size="2" min-size="0" max-size="5">
  <fd:label>Sachen</fd:label>
    <fd:widgets>
      <fd:output id="id">
        <fd:datatype base="long"/>
      </fd:output>  
      <fd:field id="extra1" required="false">
        <fd:datatype base="string"/>
      </fd:field>
      <fd:field id="extra2" required="false">
        <fd:datatype base="string"/>
      </fd:field>
      <fd:field id="extra3" required="false">
        <fd:datatype base="string"/>
      </fd:field>
    </fd:widgets>
</fd:repeater>

<fd:repeater-action id="m54_extra" command="add-row" repeater="m54_sachen">
  <fd:label>Add rows</fd:label>
</fd:repeater-action>

### template: ###

<table>
<ft:repeater-widget id="m54_sachen">
  <tr>
    <td><ft:widget id="extra1"/></td>
    <td><ft:widget id="extra2"/></td>
    <td><ft:widget id="extra3"/></td>
  </tr>
</ft:repeater-widget>
</table>

<br/>

<input type="button" xmlns="" title="" name="m54_extra" id="m54_extra" value="Test add rows" />

Diese E-Mail beinhaltet möglicherweise vertrauliche oder gesetzlich geschützte Inhalte. Sie ist ausschliesslich für die Empfänger bestimmt. Falls Sie nicht die als Empfänger bestimmte Person sind, sind Sie nicht berechtigt, die E-Mail oder Teile davon zu lesen, zu kopieren, weiterzuleiten oder anderweitig zu verwenden.
Falls Sie diese E-Mail irrtümlicherweise erreicht hat, bitten wir Sie, diese sofort vollständig zu löschen und die absendende Person umgehend zu benachrichtigen.
Die Mobiliar lehnt jegliche Haftung für Schäden im Zusammenhang mit dieser E-Mail ab. Die E-Mail-Kommunikation mit der Mobiliar kann überwacht werden.
***
Le présent courriel peut contenir des informations confidentielles ou protégées par la loi. Il est destiné exclusivement au(x) destinataire (s)indiqué (s). Si vous n'êtes pas mentionné(e) en tant que destinataire, vous n'êtes pas en droit de lire tout ou partie du présent courriel, ni de le transmettre, ni d'en faire usage de quelque manière que ce soit.
Aussi, si ce courriel vous est parvenu par erreur, nous vous prions de procéder dès à présent à sa suppression et d'en informer immédiatement la personne l'ayant expédié.
La Mobilière décline toute responsabilité quant à d'éventuels dommages en liaison avec le présent courriel. La communication par courriel avec la Mobilière peut faire l'objet d'une surveillance.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


AW: How can I use the repeater add-row function with a normal button?

Posted by Christofer Dutz <du...@c-ware.de>.
Hi Ellie

One question ... why don't you do: 
<ft:widget id="m54_extra "/>

Instead of:
<input type="button" xmlns="" title="" name="m54_extra" id="m54_extra"
value="Test add rows" />

That worked fine for me and if I didn’t manually tell cocoon to output it as
image-button it is displayed as normal html button.

Regards,
    Chris



> -----Ursprüngliche Nachricht-----
> Von: Lamvik Eldbjörg (Applikations-Entwicklerin)
> [mailto:eldbjoerg.lamvik@mobi.ch]
> Gesendet: Dienstag, 6. Juni 2006 10:29
> An: users@cocoon.apache.org
> Betreff: How can I use the repeater add-row function with a normal button?
> 
> 
> Hi, I am trying to implement a repeater widget, where extra rows are added
> when a button is clicked. I've set the repeater initial-size to "2", and
> when I load the form it shows the rows. I need to use a regular input
> button, not a submit button, because the onSubmit action is used for form
> validation. Does anybody know how to do this? Do I have to add an onClick
> event and if yes, what value should it have? I'm really stuck here, so
> help is very much appreciated!
> 
> Kind regards,
> Ellie
> (Cocoon Version: 2.1.7)
> 
> ### form definition: ###
> 
> <fd:repeater id="m54_sachen" initial-size="2" min-size="0" max-size="5">
>   <fd:label>Sachen</fd:label>
>     <fd:widgets>
>       <fd:output id="id">
>         <fd:datatype base="long"/>
>       </fd:output>
> 
>       <fd:field id="extra1" required="false">
>         <fd:datatype base="string"/>
> 
>       </fd:field>
> 
>       <fd:field id="extra2" required="false">
>         <fd:datatype base="string"/>
> 
>       </fd:field>
> 
>       <fd:field id="extra3" required="false">
>         <fd:datatype base="string"/>
> 
>       </fd:field>
> 
>     </fd:widgets>
> </fd:repeater>
> 
> <fd:repeater-action id="m54_extra" command="add-row"
> repeater="m54_sachen">
>   <fd:label>Add rows</fd:label>
> </fd:repeater-action>
> 
> ### template: ###
> 
> <table>
> <ft:repeater-widget id="m54_sachen">
>   <tr>
>     <td><ft:widget id="extra1"/></td>
>     <td><ft:widget id="extra2"/></td>
>     <td><ft:widget id="extra3"/></td>
>   </tr>
> </ft:repeater-widget>
> </table>
> 
> <br/>
> 
> <input type="button" xmlns="" title="" name="m54_extra" id="m54_extra"
> value="Test add rows" />
> 
> Diese E-Mail beinhaltet möglicherweise vertrauliche oder gesetzlich
> geschützte Inhalte. Sie ist ausschliesslich für die Empfänger bestimmt.
> Falls Sie nicht die als Empfänger bestimmte Person sind, sind Sie nicht
> berechtigt, die E-Mail oder Teile davon zu lesen, zu kopieren,
> weiterzuleiten oder anderweitig zu verwenden.
> Falls Sie diese E-Mail irrtümlicherweise erreicht hat, bitten wir Sie,
> diese sofort vollständig zu löschen und die absendende Person umgehend zu
> benachrichtigen.
> Die Mobiliar lehnt jegliche Haftung für Schäden im Zusammenhang mit dieser
> E-Mail ab. Die E-Mail-Kommunikation mit der Mobiliar kann überwacht
> werden.
> ***
> Le présent courriel peut contenir des informations confidentielles ou
> protégées par la loi. Il est destiné exclusivement au(x) destinataire
> (s)indiqué (s). Si vous n'êtes pas mentionné(e) en tant que destinataire,
> vous n'êtes pas en droit de lire tout ou partie du présent courriel, ni de
> le transmettre, ni d'en faire usage de quelque manière que ce soit.
> Aussi, si ce courriel vous est parvenu par erreur, nous vous prions de
> procéder dès à présent à sa suppression et d'en informer immédiatement la
> personne l'ayant expédié.
> La Mobilière décline toute responsabilité quant à d'éventuels dommages en
> liaison avec le présent courriel. La communication par courriel avec la
> Mobilière peut faire l'objet d'une surveillance.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org