3 Replies Latest reply on Mar 26, 2013 2:35 AM by lufecir28

    Unable to set maximum for tags widget

    lufecir28

      Hello,

       

      according to the 'tags' widget (/libs/cq/tagging/widgets/source/widgets/TagInputField.js) documentation it should be possible to restrict the namespaces to select from usint the 'namespaces' attribute.

      This works fine if I only specify the namespaces to restrict to (namespaces = [namespace1,namespace2].

      But still according to the documentation, it should also be possible to restrict the number of tags that can be selected using the following format for each namespace in the 'namespaces' array:

       

      {

          name: "namespace",

          maximum: 1

      }

       

      Unfortunately, that does not work. I have tried all sorts of combinations.

       

      Anyone else stumbled into this issue?

       

      Kind regards,

       

      Luc

        • 1. Re: Unable to set maximum for tags widget
          PaulFlory

          I found this corner of the documentation to be sketchy, but finally started making progress using syntax like the sample below, but then the requirements changed and I didn't need to pursue further.

           

          If you defined, say, a second namespace and maximum attribute, following the same pattern, I'd expect/hope this would work.

           

          Let us know if that gets you down the right path?

           

          -Paul

           

            <locationTag jcr:primaryType="cq:Widget" allowBlank="{Boolean}false"
                 cls="cq-propsdialog-tags" fieldLabel="Campus Location"
                 fieldDescription="Specify a campus location" name="./locationID/cq:tags"
                                                            xtype="tags">
                 <namespaces jcr:primaryType="cq:WidgetCollection">
                      <ns1 jcr:primaryType="nt:unstructured" maximum="1"  name="campuses" />
                 </namespaces>
            </locationTag>
          
          
          • 2. Re: Unable to set maximum for tags widget
            aklimets Adobe Employee

            This should work - what issue do you see exactly? Note that you still restrict to the namespaces that you actually list there.

            • 3. Re: Unable to set maximum for tags widget
              lufecir28 Level 1

              Hi Paul,

               

              your answer worked for me. I thought I had to specify the namespaces in the JSON format, as I found in the tags widget documentation. But the JSON was then being interpreted as a single namespace string, resulting in my namespace not being found and thus in an empty list of tags to select from.

              Looking at the structure you suggested, it actually makes sense to do it that way. Everything is content and every object is a node. And I was trying to stuff an object into a string property in JSON format.

               

              Thanks a lot.

               

              Kind regards,

               

              Luc Feys