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
Mandar Kulkarni 13Mandar Kulkarni 13 

restrict <apex:inputField type="number" value="{!Con.No_of_Tickets__c}" html-placeholder=" Quantity.." /> to only show positive numbers.

I am taking quantity of product in this field and storing number of quantity.its showing up down arrow..but on down arrow its going below 0 i.e -1,-2... so i dnt want values below 0.how do i restrict it????
Best Answer chosen by Mandar Kulkarni 13
GulshanRajGulshanRaj

Hi Mandar,

Use html-min to define minumum value as 0 and onkeypress restrict negative values like this:
<apex:inputField html-min="0"  type="number" value="{!somevalue}" onkeypress="return event.charCode >= 48 && event.charCode <= 57" />

If this resolve your problem, please mark this as solved , so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Thanks & Regards
Gulshan Raj

LinkedIn (https://www.linkedin.com/in/gulshan-raj-a26b0640/)
Twitter (https://twitter.com/gulshan_bittoo)

All Answers

GulshanRajGulshanRaj

Hi Mandar,

Use html-min to define minumum value as 0 and onkeypress restrict negative values like this:
<apex:inputField html-min="0"  type="number" value="{!somevalue}" onkeypress="return event.charCode >= 48 && event.charCode <= 57" />

If this resolve your problem, please mark this as solved , so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Thanks & Regards
Gulshan Raj

LinkedIn (https://www.linkedin.com/in/gulshan-raj-a26b0640/)
Twitter (https://twitter.com/gulshan_bittoo)
This was selected as the best answer
Mandar Kulkarni 13Mandar Kulkarni 13
Thank you so much..
Isuue Solved..