[5.8] Phonenumber in profile may contain non numeric characters

Hi There,

I noticed that it is possible to fill in non numeric characters in the phone number field of a user.

I might want to change this behavior. Is it correct that I have to extend the weblayoutManager widgettypes Extensionpoint (Like this file: http://fisheye.nuxeo.com/browse/nuxeo-user-center/nuxeo-user-profile/src/main/resources/OSGI-INF/layouts-contrib.xml?r=b1adf0708230f0cc2ba582a18a47827cd74b73fc )

<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager" point="widgettypes">

Then add a widtget with a property validator

   <widget name="phonenumber" type="text">
     <labels>
       <label mode="any">label.userprofile.phonenumber</label>
     </labels>
     <translated>true</translated>
     <fields>
       <field>userprofile:phonenumber</field>
     </fields>
     <properties widgetMode="edit">
       <property name="styleClass">dataInputText</property>
       <property name="validator">#{myValidatorBean.validatePhoneNumber}</property>
     </properties>
   </widget>

And finally create a validator as specified on this page: http://doc.nuxeo.com/display/NXDOC/Add+Field+Validation

I think This is the way to go, but I just wanted to check :-)

Best regards,

Bauke Roo

0 votes

1 answers

1172 views

ANSWER



Hi,

You need to use the extension point “widgets”, not “widgettypes”, but otherwise, it seems all good.

0 votes