Hi Team,
I want to restrict user to enter only Integer value in the UI field. I created Number type UI field with 0 decimal places. But you can enter anything into the UI field.
I am storing that UI field value into the salesforce field which is also Number (18,0) type.
When user are enter decimal values then decimal values is saving into that field.
I also added the validation rule for restricting the field to enter the decimal values. But when validation error come then UI field is automatically showing the round off value on the UI but in the back end decimal value is present.
Can we done anything on the skuid side for this requirement.
Thanks,
Geeta Garg
Solved
How to restrict user to enter the decimal value in the UI field?
Best answer by matt.davis
I noticed this has been a frequently viewed discussion, so I figured I would update it with the latest and greatest:
This is easier to accomplish now that Skuid has a client-side validations framework for fields! Below is a quick example of what it can look like, along with some XML. You can read more about the validations framework here.

<skuid__page unsavedchangeswarning="yes" personalizationmode="server" showsidebar="false" showheader="false">
<models>
<model id="model" limit="20" query="true" createrowifnonefound="true" datasource="Ui-Only">
<fields>
<field id="num2decimals" displaytype="DOUBLE" length="255" label="Number with 2 decimals" ogdisplaytype="TEXT" precision="2" scale="2"/>
<field id="num9digits" displaytype="DOUBLE" length="255" label="Integer with 9 Digits" ogdisplaytype="TEXT" precision="9" scale="0"/>
<field id="num2decimal2digit" displaytype="DOUBLE" length="255" label="Number from 0 to 99.99" ogdisplaytype="TEXT" precision="2" scale="2"/>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<skuid__form showErrorsInline="true" model="model" uniqueid="sk-3jx6-12849" mode="edit">
<columns>
<column>
<sections>
<section title="Numbers">
<fields>
<skuid__field id="num2decimals">
<renderConditions logictype="and" onhidedatabehavior="keep"/>
<enableConditions/>
<styleVariantConditions/>
<validations validateOn="change">
<requiredValidation type="required" enable="true"/>
<validation enable="true" type="formula" validationErrorMessage="The number can only have two decimal places">
<formula>(({{num2decimals}}*100) - FLOOR({{num2decimals}}*100)) == 0</formula>
</validation>
</validations>
</skuid__field>
<skuid__field id="num9digits">
<validations validateOn="change">
<requiredValidation type="required" enable="true"/>
<validation enable="true" type="formula" validationErrorMessage="Number can only be 9 digits">
<formula>LEN({{num9digits}})<=9</formula>
</validation>
<validation enable="true" type="formula" validationErrorMessage="The number must be an integer">
<formula>(({{num9digits}}) - FLOOR({{num9digits}})) == 0</formula>
</validation>
</validations>
<renderConditions logictype="and" onhidedatabehavior="keep"/>
<enableConditions/>
<styleVariantConditions/>
</skuid__field>
<skuid__field id="num2decimal2digit">
<validations validateOn="change">
<requiredValidation type="required" enable="true"/>
<validation enable="true" type="formula" validationErrorMessage="The number can only have two decimal places">
<formula>(({{num2decimal2digit}}*100) - FLOOR({{num2decimal2digit}}*100)) == 0</formula>
</validation>
<validation enable="true" type="formula" validationErrorMessage="The left of the decimal can only be 0 to 99">
<formula>LEN(FLOOR({{num2decimal2digit}}))<=2</formula>
</validation>
</validations>
<renderConditions logictype="and" onhidedatabehavior="keep"/>
<enableConditions/>
<styleVariantConditions/>
</skuid__field>
</fields>
</section>
</sections>
</column>
</columns>
<styles>
<spacing top="2" right="2" bottom="2" left="2"/>
</styles>
</skuid__form>
</components>
<resources>
<labels/>
<javascript/>
<actionsequences/>
</resources>
<background/>
<interactions/>
<surfaces/>
</skuid__page>
This topic has been closed for replies.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

