3 Replies Latest reply on Jul 9, 2013 4:29 PM by Sandeep Oracle

    how to restrict decimal values from number in OAF

    977941

      Hi All,

       

      My requirement is, when ever user enter number in text box, if the number having decimal it should throw an exception to enter for only integer values.

       

      Appreciate help on this.

       

      Regards,

      Rakesh

        • 1. Re: how to restrict decimal values from number in OAF
          Sandeep Oracle

          Hi 977941,

           

          Please set the following properties for a field and check for decimal point

           

          Action Type : firePartialAction

          Event : validateInteger

           

          Create a controller and add the following in Process From Request :

           

          if ("*validateInteger*".equals(pageContext.getParameter(EVENT_PARAM))) // identifier should be same as what you have set .

           

          {

          get the value here and check if the decimal exist and throw exception message .

          }


          Thanks

          Sandeep

          • 2. Re: how to restrict decimal values from number in OAF
            977941

            Hi Sandeep,

             

            Thanks for reply.

             

            I am new to OAF, if possible could please provide the code how to handle decimal in the validateinteger event.

             

            Regards,

            Rakesh

            • 3. Re: how to restrict decimal values from number in OAF
              Sandeep Oracle

              Hi Rakesh,

               

              Please try the code below

               

              if ("*validateInteger*".equals(pageContext.getParameter(EVENT_PARAM))) // identifier should be same as what you have set .

               

              {


              OAMessageTextInputBean stb1=(OAMessageTextInputBean)oawebbean.findIndexedChildRecursive("BeanID"); // repalce your exact bean id

              String MessageTextValue= stb1.getValue().toString();

              if(MessageTextValue != null)

              {

              String.parseString(MessageTextValue ).contains("."); // Check if this returns true / false

               

              get the value here and check if the decimal exist and throw exception message .

              }


              }

              Thanks

              Sandeep