Expand my Community achievements bar.

SOLVED

How to disable the manual entry of the tags in tagfield

Avatar

Level 4

Hi all,

 

I need to disable the manual entry of the tags in tagfield in assert property, for example when typing the tag name in the tag field it should populate the suggested tags in the dropdown list so either i need to select from the list or else i need to select the tags using the browse icon in the tagfield, when typing the tag name in the tag field and clicking enter it should not add the tag in the field, so how can we prevent this functionality any one can give some suggestion on this please.

 

Thanks

Nandheswara

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Nandheswara 

You may need to create a custom metadata schema to add following property to tag field

 

/**
       * Indicates if the user must only select from the list of given options.
       * If it is not forced, the user can enter arbitrary value.
       */
      - forceSelection (Boolean)

      /**
       * When ``forceSelection = false``, ``true`` to create the user defined tag during form submission; ``false`` otherwise.
       */
      - autocreateTag (Boolean)

 

/libs/cq/gui/components/coral/common/form/tagfield/render.jsp



Arun Patidar

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @Nandheswara 

You may need to create a custom metadata schema to add following property to tag field

 

/**
       * Indicates if the user must only select from the list of given options.
       * If it is not forced, the user can enter arbitrary value.
       */
      - forceSelection (Boolean)

      /**
       * When ``forceSelection = false``, ``true`` to create the user defined tag during form submission; ``false`` otherwise.
       */
      - autocreateTag (Boolean)

 

/libs/cq/gui/components/coral/common/form/tagfield/render.jsp



Arun Patidar

Avatar

Level 4

Hi @Nandheswara ,

 

Just wondering why are you trying to prevent the enter key on a tagfield? When you try to add a bad value which is not resolved as tag, you should not be able to save the dialog. I tried on a Page Property and get the error while saving it-

anupampat_1-1710945871888.png

 

 

Avatar

Community Advisor

@Nandheswara , Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.