Sat. Dec 4th, 2021

Requirement: We have a Text Field, and we want to ensure that whatever value we enter in this Text Field is only an Integer value.

In case the user tries to enter any value other than the Integer value it will simply not be entered into the Text Field.

Solution: For solution of the above requirement follow the steps as shown below:

Step 1: Create an Oracle APEX page. Create a Region inside the page and set Title as Allow only Integer Value

Step 2: Create a Page Item inside the above created Region. Set the properties for the Page Item as below:

  • Name: P6_ENTER_VALUE
  • Type: Text Field
  • Label: Enter Value

Go to the Advanced section of the property palette of the Page Item and set the below properties

  • CSS Classes: allow-integer

Step 3: Let us add the following jQuery code to the Execute when Page Loads section for the page:

$(".allow-integer").bind("keypress", function (e) {
    var keyCode = e.which ? e.which : e.keyCode               
    if (!(keyCode >= 48 && keyCode <= 57)) {
        return false;
    }else{
    
	}
});

Save and run the application. Thus, the ran application is shown below:

Try to enter values other than the Integer value, and we can see it is not allowing us to enter the value. When we enter Integer value, say 123, it has excepted the Integer value 123 as shown below:

Hence, the solution to our requirement.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 360 total views,  3 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *

satta king chart