Integer Field Example

 

         Now we are developing a CRUD portlet where we mantain a table with a varchar and an integer field. In integer fields you also can use regexp validations in this example we are using it:

 

 

<field>
<name>integerField</name>
   <title>Integer Field</title>
   <type>
   <int>
      <length>5</length>
      <nullable>false</nullable>
      <regexp>integer_regexp</regexp>
      <order>true</order>
      <signed>false</signed>
      <zerofill>false</zerofill>
   </int>
   </type>
<showFieldInView>true</showFieldInView>
<required>true</required>
</field>

 

 

         This is how the portlet will look in the page with Liferays Classic theme. 

 

In case you try to enter wrong data type in a numeric field, like the next image shows:

 

You will get an error mesaje like this:

          Here you have the full XMLPortletFactory xml file.

XMLPFEIntegerExample.xml

          And here you have the portlet war generated. (for liferay 6.0.6)

xmlpfIntegerRegexpExample-portlet-6.0.6.1.war

          If you want to use this example you can follow instructions here DOCUMENTATION