5 Replies Latest reply: Mar 20, 2013 7:25 PM by HamidHelal RSS

    verification of an item text

    982158
      Hi,
      I want to make a verification of an item text ,the user must enter a number of length 4.
      So I created a text item :number(4).
      and in when-validate-item trigger of this item ,I put this code:

      if length(:block.empno) != 4 then
      message('this item must containonly 4 digit');
      end if;


      => the problem, when the user entered "*0123*" ,it should be acceptable !! but this is not the case ...


      any suggestions ?
        • 1. Re: verification of an item text
          HamidHelal
          979155 wrote:
          Hi,
          I want to make a verification of an item text ,the user must enter a number of length 4.
          So I created a text item :number(4).
          and in when-validate-item trigger of this item ,I put this code:

          if length(:block.empno) != 4 then
          message('this item must containonly 4 digit');
          end if;


          => the problem, when the user entered "*0123*" ,it should be acceptable !! but this is not the case ...
          As salamualikum,
          In a number format data type you cannot insert *0* at first number. but you can display.
          • 2. Re: verification of an item text
            user346369
            Make it a char datatype, maximum length 4, fixed Length = Yes.

            You will then need to edit the field to make sure no alpha characters were entered:

            <pre>If translate(:Blk.Itm,'*0123456789','*') is not null then
            Message(' Error, Item must be numeric');
            Raise form_trigger_failure;
            End if;</pre>
            • 3. Re: verification of an item text
              982158
              is that I can use the notion of regular expression?
              like this:
              ^0[0-9]+$

              Edited by: 979155 on 20 mars 2013 06:13
              • 4. Re: verification of an item text
                982158
                I don't found this property : fixed Length = Yes. !!
                • 5. Re: verification of an item text
                  HamidHelal
                  979155 wrote:
                  I don't found this property : fixed Length = Yes. !!
                  I don't know is there any property name fixed length in form release 10g

                  Fixed length property is obsulate from 10g and later. just use format mask with the relevant data type works...

                  Check this link http://docs.oracle.com/cd/B12166_01/web/B10469_01/props.htm


                  Hope this helps

                  Hamid

                  Edited by: HamidHelal on Mar 21, 2013 6:23 AM