You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bartosz Zgodzinski <ba...@poczta.onet.pl> on 2004/05/14 17:51:56 UTC

Is it posibile to send parameters into form definition.

This is mine form definition file:
    
<fd:form
  xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
   xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">


 <fd:repeater id="name" initial-size="{$my_var}">
  <fd:label>repeater</fd:label>
   <fd:widgets>
   <fd:field id="nazw1" >
     <fd:label>name</fd:label>
     <fd:datatype base="string"/>
   </fd:field>
   <fd:field id="nazw2" required="true">
     <fd:label>Nazwa:</fd:label>
     <fd:datatype base="string"/>
   </fd:field>
  </fd:widgets>
 </fd:repeater>

    {....}
</fd:form>

And now I want to send a variable from java script:
 var form = new Form("forms/my_form_definition_file.xml",{"my_var":my_var}); <--this doesn't work
 form.showForm("forms/t_nowyTyp.xml",{"my_var":my_var}); <-- when I send my_var to form template it works




Bartosz Zgodzinski

Re: Is it posibile to send parameters into form definition.

Posted by Bruno Dumon <br...@outerthought.org>.
On Fri, 2004-05-14 at 17:51, Bartosz Zgodzinski wrote:
> This is mine form definition file:
>     
> <fd:form
>   xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>    xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
>  
>  
>  <fd:repeater id="name" initial-size="{$my_var}">
>   <fd:label>repeater</fd:label>
>    <fd:widgets>
>    <fd:field id="nazw1" >
>      <fd:label>name</fd:label>
>      <fd:datatype base="string"/>
>    </fd:field>
>    <fd:field id="nazw2" required="true">
>      <fd:label>Nazwa:</fd:label>
>      <fd:datatype base="string"/>
>    </fd:field>
>   </fd:widgets>
>  </fd:repeater>
>  
>     {....}
> </fd:form>
> 
> And now I want to send a variable from java script:
>  var form = new
> Form("forms/my_form_definition_file.xml",{"my_var":my_var}); <--this
> doesn't work
>  form.showForm("forms/t_nowyTyp.xml",{"my_var":my_var}); <-- when I
> send my_var to form template it works
> 

This is not possible.

Just add the required number of rows to the repeater yourself by calling
addRow.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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