control the numbers of a repeated component in a node

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

control the numbers of a repeated component in a node

Ilan Cohen

 

Dear all,

 

I’ve used the following code which allows forms users to add single text-line in their form each time they click the “add button” :

 

<fr:repeat nodeset="responsable" id="responsable-repeat"   origin="instance('responsable-template')"  columns="1"   appearance="xxforms:table">

                <fr:body>

                      <fr:tr>

                           <fr:td>

                               <xforms:input id="note-control" ref="." appearance="xxforms:autosize" incremental="true">

                                               <xforms:label ref="$form-resources/responsable/label"/>

                               </xforms:input>

                          </fr:td>

                </fr:tr>

         </fr:body>

  </fr:repeat>

 

It works perfectly however, I would like to have maximum 5  single text-line and one for the minimum.

 

Does anybody have an idea ??

 

Regards,

 

Ilan



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: control the numbers of a repeated component in a node

stacyladnier
Ilan,

From the XForms 1.1 specification:

"Specifying minimum and maximum occurrences for nodes in the instance
data can be achieved by using the count() function within a constraint
property."

So in your model, use a bind to add a constraint using the count() function.

-Stacy

 

Dear all,

 

I’ve used the following code which allows forms users to add single text-line in their form each time they click the “add button” :

 

<fr:repeat nodeset="responsable" id="responsable-repeat"   origin="instance('responsable-template')"  columns="1"   appearance="xxforms:table">

                <fr:body>

                      <fr:tr>

                           <fr:td>

                               <xforms:input id="note-control" ref="." appearance="xxforms:autosize" incremental="true">

                                               <xforms:label ref="$form-resources/responsable/label"/>

                               </xforms:input>

                          </fr:td>

                </fr:tr>

         </fr:body>

  </fr:repeat>

 

It works perfectly however, I would like to have maximum 5  single text-line and one for the minimum.

 

Does anybody have an idea ??

 

Regards,

 

Ilan



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: control the numbers of a repeated component in a node

Hank Ratzesberger
In reply to this post by Ilan Cohen
Ilan,

One way to enable/disable a trigger (the "add button") is to bind it (ref=)
to a node, such as the node that contains the number of lines added. 
In turn, the node needs a binding where the relevant attribute is 
calculated, e.g., 
relevant="(.< 4) and (. > 1)" 

A trigger bound to a reference that is not relevant will be disabled.

Something that is not much discussed ... that besides the instance 
you submit, you need one for form control.

HTH,
Hank


On Apr 30, 2009, at 3:17 AM, Ilan Cohen wrote:

 

Dear all,

 

I’ve used the following code which allows forms users to add single text-line in their form each time they click the “add button” :

 

<fr:repeat nodeset="responsable" id="responsable-repeat"   origin="instance('responsable-template')"  columns="1"   appearance="xxforms:table">

                <fr:body>

                      <fr:tr>

                           <fr:td>

                               <xforms:input id="note-control" ref="." appearance="xxforms:autosize" incremental="true">

                                               <xforms:label ref="$form-resources/responsable/label"/>

                               </xforms:input>

                          </fr:td>

                </fr:tr>

         </fr:body>

  </fr:repeat>

 

It works perfectly however, I would like to have maximum 5  single text-line and one for the minimum.

 

Does anybody have an idea ??

 

Regards,

 

Ilan


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
OW2 mailing lists service home page: http://www.ow2.org/wws

Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: control the numbers of a repeated component in a node

Ilan Cohen

Hank,

 

Thank you for the answer.

I’m using the <fr:repeat nodeset= …> code. So I don’t have triggers . I know that with triggers, and the relevant attribute, I can set bounds for  the added components. I already try it and it does work.

However, when I set this code to add component in my form, I had another problem described in the mail named “[ops-users] add components wich contain different value in a form” :

Each time I enter a value in on one of the single line text added by my trigger, the others single line text of the same node automatically take the same value.

So I change my code and choose the fr:repeat .

Regards

 

Ilan

 

 

De : Hank Ratzesberger [mailto:[hidden email]]
Envoyé : jeudi 30 avril 2009 17:24
À : [hidden email]
Objet : [ops-users] Re: control the numbers of a repeated component in a node

 

Ilan,

 

One way to enable/disable a trigger (the "add button") is to bind it (ref=)

to a node, such as the node that contains the number of lines added. 

In turn, the node needs a binding where the relevant attribute is 

calculated, e.g., 

relevant="(.< 4) and (. > 1)" 

 

A trigger bound to a reference that is not relevant will be disabled.

 

Something that is not much discussed ... that besides the instance 

you submit, you need one for form control.

 

HTH,

Hank

 

 

On Apr 30, 2009, at 3:17 AM, Ilan Cohen wrote:



 

Dear all,

 

I’ve used the following code which allows forms users to add single text-line in their form each time they click the “add button” :

 

<fr:repeat nodeset="responsable" id="responsable-repeat"   origin="instance('responsable-template')"  columns="1"   appearance="xxforms:table">

                <fr:body>

                      <fr:tr>

                           <fr:td>

                               <xforms:input id="note-control" ref="." appearance="xxforms:autosize" incremental="true">

                                               <xforms:label ref="$form-resources/responsable/label"/>

                               </xforms:input>

                          </fr:td>

                </fr:tr>

         </fr:body>

  </fr:repeat>

 

It works perfectly however, I would like to have maximum 5  single text-line and one for the minimum.

 

Does anybody have an idea ??

 

Regards,

 

Ilan

 

--

You receive this message as a subscriber of the [hidden email] mailing list.

To unsubscribe: [hidden email]

For general help: [hidden email]

OW2 mailing lists service home page: http://www.ow2.org/wws

 

Hank Ratzesberger

NEES@UCSB

Institute for Crustal Studies,

University of California, Santa Barbara

805-893-8042

 

 

 



 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: control the numbers of a repeated component in a node

Alessandro Vernet
Administrator
Ilan,

Ilan Cohen wrote
I’m using the <fr:repeat nodeset= …> code. So I don’t have triggers . I know
that with triggers, and the relevant attribute, I can set bounds for  the
added components. I already try it and it does work.
fr:repeat supports the minOccurs/maxOccurs attributes (e.g. minOccurs="2" maxOccurs="6"). If you don't want to have a constraint on the mix or the max you can just ignore that particular attribute.

Alex