function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
siddarth rajsiddarth raj 

What is the best approach for number validations (only +ves) in visualforce

Hi folks

In my requirement, I have a page with the around 25 numbers entry.. for one object creation. All must be +ve numbers. Can I please be given best approach to implement this validation on apex page.

Thanks
Sri
Best Answer chosen by siddarth raj
PratikPratik (Salesforce Developers) 
Hi Sri

You can try this:

OR (  (field1__c<0), (field2__c < 0) , (field3__c < 0).......,(field25__c < 0) )

Thanks,
Pratik

All Answers

PratikPratik (Salesforce Developers) 
Hi Sri

You can try this:

OR (  (field1__c<0), (field2__c < 0) , (field3__c < 0).......,(field25__c < 0) )

Thanks,
Pratik
This was selected as the best answer
Ravi Dutt SharmaRavi Dutt Sharma
Try using JS valdiations. Add onblur event on your input field.
<apex:inputField value={!objName.FieldName} onblur="yourJSFunction();"/>