Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Text masking in databound components

    I am trying to implement text masking in a dynamic form. Currently I am letting the fields be created automatically from my ds.xml source (EE version). I would like to enforce phone number format, capitalization etc on these fields. The example in the showcase shows TextItems being created before masks being applied. Is there a way to apply text masking directly to the ds.xml fields ?

    Thank you in advance for your help.

    #2
    Gentle Nudge

    Any suggestions Isomorphic on how best to implement text masking from SmartGWT directly with XML datasources in EE?

    Comment


      #3
      In general you scan put attributes such as a text mask in your field definitions in your .ds.XML file and it will behave as though the setting appeared on the component field. However, the cleaner way to do this is to add your own custom properties to the .ds.XML file and subclass components so that they noticew those properties and have special behaviors, such as enabling text masking.

      Comment


        #4
        That's great. Could you point me to either an example or where in the javadoc I can find details. The only place I have found text masking detailed is in the the TextItem javadoc. If I need to use TextItem, I am confused as to how to put the refer link a textItem to my ds.XML field. I have looked in DynamicForm and haven't found any methods related to enabling text masking for FormItems.

        Thank you.

        Comment


          #5
          Something like:
          Code:
          <field name="PhoneNo" title="Phone #" type="text" length="12" mask="###-###-####" />
          Of course you can put whatever properties you want on field as well:

          Code:
          <field name="PhoneNo" title="Phone #" type="text" length="12" myMask="###-###-####" />
          Then your subclassed TextItem can pick up the property via getAttribute().

          Comment

          Working...
          X