Validation on numerical values in webdynpro

Hi Friends,
I am facing one probelem with  validation on numerical values. In my application there is a scenario.. Input fields are  Mibile number  and  email id.
when i enter the invalid phone  number like : 09988wertyy    it should throw the error like  enter  only numerical values.
In the same way  i should  validate the email id with format .. like  ratnakar.alwala@ accenture.com. if it is in valid then it should throw the error.
could  any body  please give me the approach.
Thanks and Regards
Ratnakar reddy alwala

Hi Ratnakar,
For number validation, what I did was :
1. Bind a context variable (Say Number) of type String to the input Field
2. At the time of submission, do the following
String num=wdContext.xurrentContextElement().getNumber();
if(num!=null)
  try
        double num=new Double(amnt.trim()).doubleValue();
  catch(NumberFormatException exc)//IF AMOUNT ENTERED IS NOT VALID
   wdComponentAPI.getMessageManager().reportException("Invalid Number",true);
Regards
Fahad Hamsa

Similar Messages

  • Validation of numeric value precision and scale

    Hi all,
    Iam using ADF with EJBs.
    I have one inputText field that will accept numeric values (of java.lang.Double type). Due to database constraints I want to validate the input value on its precision and scale.
    I put an f:convertNumber tag under the inputText and set the MaxIntegerDigits and MaxFractionDigits properties with the desired values.
    I also set the ApplyValidation property of the corresponding attribute in the pagedef file. However no validation worked.
    I made the same test with af:ConvertNumber with no result too.
    I know that with BC4J it is easy to set such constraints at the entity level.
    Is there any neat way to set validation or I need to write code in the backing bean?

    <af:convertNumber> works fine for me. see the following code
    <af:inputText id="it1">
    <af:convertNumber type="number" minFractionDigits="2" maxIntegerDigits="4" maxFractionDigits="2"/>
    </af:inputText>
    Another possible solution with regular expression
    <af:inputText id="it3" value="9999.99">
    <af:validateRegExp pattern="\[0-9\]\[0-9\]\[0-9\]\[0-9\].\[0-9\]\[0-9\]"/>
    </af:inputText>
    regards
    srini
    Edited by: sangara on Jan 17, 2010 9:53 PM

  • Validating numeric value in a filename

    I have a file and the filename  should be like ABC_12345_RES_20150410.txt and i have to validate the filename.I am facing problem in validating the numeric value which can change and its length also can change.
    I am using the following expression to validate whether its the numeric value /not:
    (DT_I4)(SUBSTRING( @[User::FileName]  ,FINDSTRING( @[User::FileName]  ,"_", 1)+1, FINDSTRING( @[User::FileName]  ,"_", 2)-FINDSTRING( @[User::FileName]  ,"_", 1)-1)) == (DT_I4)(SUBSTRING( @[User::FileName] 
    ,FINDSTRING( @[User::FileName]  ,"_", 1)+1, FINDSTRING( @[User::FileName]  ,"_", 2)-FINDSTRING( @[User::FileName]  ,"_", 1)-1))
    This statement is failing the package when i am entering a character instead of digit.. But i don't want the package to fail rather i just want to log the exception in this case.
    Is there any other way to validate the numeric Value?
    Many Thanks in Advance!

    Thanks a ton Martin for your advice.
    I can do that but Actually the conversion is failing.. its giving error that cannot convert to (DT_I8). M looking for any other  way to validate  the numeric value.

  • Validation To check numeric value

    BEGIN
    IF :P3_TOTAL_AMOUNT >= :P3_NET_AMOUNT THEN
    RETURN TRUE;
    ELSE
    RETURN FALSE;
    END IF;
    END;
    The function returning boolean should compare total amount and net amount and through error if it less than net amount.
    It works fine when the value of TOTAL amoun =365 and value of net amount = 364*(if it is all numeric value and no zero behind it)*
    But the problem is
    when is use Total amount = 9 and net amount = 100 (It doesnt works becuse it just takes 1 from the net amount and eliminates the zeros behind the 1(100) and it doesnt comes up with a error after validation )
    Is there any one who can help me with this
    Thanks,
    Hary

    Lev,
    I'm not sure I follow. If you use to_number with a format mask and the user doesn't follow your mask, you'll get an error:select to_number('1000','999G990') from dual;This throws an "ORA-01722: invalid number" exception. That's why I say to try calling to_number without a format mask first, to handle the trivial case of the user not putting in the grouping separators (or whatever else is involved in your format).
    You could, of course, put in a validation to make sure that the number follows the format you're expecting before you convert it (either for further validation, as in the original post, or for processing), but then you have multiple places where the format mask is specified--not to mention the annoyance for users when they put in a number only to be told that they need to use the appropriate grouping separators as well. My solution uses the data dictionary to get the format mask assigned to the page item and feeds that to to_number; if I change the page item's format mask, all of my processes automatically handle the new format. Because of the extra lookup, it's slightly slower than hard-coding the format mask, but that should be minimal as long as you don't use it in a where clause.
    -David

  • ALV WebDynpro Hierarchy -Setting non-numeric values in the header level row

    Hi Experts,
    When setting up an ALV table as a table hierarchy the standard ALV settings only seem to allow for numeric values to be displayed in the higher hierarchy levels. Is there a way to also set the values for some non-numeric columns into these higher-level rows - programmatically or through the ALV Settings?
    Example: I have delivery item level data in my context and the delivery number as a hierarchy column. Some columns in my context however actually come from the delivery header e.g. delivery block, delivery priority, ship-to etc and I would like to display these in the collapsed header rows of the delivery number.
    It seems obvious to me that this should be doable otherwise if you are looking at at a list of hundreds of deliveries and all you see besides the delivery number is numeric data such as sums & totals, it's kind of hard to know which delivery you might want to expand the sub-level for.
    Please help,
    Peter

    Hi,
    Even we have faced the same issue.
    In ALV hierarchy, we cannot display data at header items/levels. this is a constraint in ALV. You can achieve the same usign TABLE UI element.

  • Popup Key LOV, NULL and "Invalid numeric value undefined for column"

    Hello.
    I've created an item based on database column of NUMBER type and set the following properties:
    Display As = Popup Key LOV (Displays description, returns key value)
    List of values definition=select 'display_value' d, 1 r from dual
    Null display value=%
    Null return value=
    Display Null=Yes
    When I select "%" in the LOV and try to apply changes to database I get error:
    ORA-20001: Error in DML: p_rowid=1781, p_alt_rowid=N1, p_rowid2=, p_alt_rowid2=. ORA-20001: Invalid numeric value undefined for column N2
    Error Unable to process row of table TTT.
    If I set Display As = Select List, all works fine. But I need Popup Key LOV.
    Could anybody help me?
    I use Application Express 2.2.1.00.04

    Hi all,
    I did my homework and solved this issue. First I would like to thank Patrick Wolf for the invaluable help he gives out on thread Re: Null value handling in LOVs The code presented here is just a minor edit to his code, but an essential one when dealing with Popup Key LOV items.
    Here's what I did:
    1. Create an Application Process.
    Name: RemoveNulls
    Sequence: 0
    Point: On Submit: After Page Submission - Before Computations and Validations
    Process Text:
    BEGIN
        FOR rItem IN
          ( SELECT ITEM_NAME
              FROM APEX_APPLICATION_PAGE_ITEMS
             WHERE APPLICATION_ID   = TO_NUMBER(:APP_ID)
               AND PAGE_ID          IN (TO_NUMBER(:APP_PAGE_ID), 0)
               AND LOV_DISPLAY_NULL = 'Yes'
               AND LOV_DEFINITION   IS NOT NULL
               AND LOV_NULL_VALUE   IS NULL
        LOOP
            IF (V(rItem.ITEM_NAME) = '%null' || '%' OR V(rItem.ITEM_NAME) = 'undefined')
            THEN
                Apex_Util.set_session_state(rItem.ITEM_NAME, NULL);
            END IF;
        END LOOP;
    END;Error Message: #SQLERRM#Condition: None
    2. You should be able to submit a Popup Key LOV with a NULL value now.
    Once again, THANKS, Patrick! You rock! I'm seriously thinking of trying ApexLib now :)
    Georger

  • Can one assign a numerical value to a variable?

    Hi All,
    Good afternoon,
    I am currently working on a form that has strings as values in 2 different listboxes, and depending on what is selected a message pops up. Here is the script I wrote, but it does not seem to work right
    var a=aKlaclistbox.raWvalue=="SSK";
    var b=bZlaslistbox.raWvalue=="SGT";
    a.value=1;
    b.value=2;
    if(a > b){
        xfa.host.messagebox("You cannot select a lower officer as the rating officer");
    It does not work, and I am just wondering if there is any way I can get around it so that I can compare the values. I need help from anyone on this forum.
    Thanks
    v/r
    Tammy

    There's probably a better way of doing this, as, depending on how many ranks you have, it could get cumbersome. Like using an array or something like that but not sure how to accomplish that.
    If there are a lot of ranks to compare I think I'd suggest reworking things so that you can use the numeric value of the list box, it will be much easier in the long run.
    As I mentioned above, I don't think the following is valid code:
    var a=aKlaclistbox.raWvalue=="SSK";
    Nor is (unless dealing with global variables):
    a.value=1;
    I think you need to do something like the following (hopefully someone else around here might have a better idea!):
    var a;
    var b;
    if (aKlaclistbox.rawValue == "SSK") {
         a = 1;
    if (bZlaslistbox.rawValue == "SGT") {
         b = 2;
    //You would need a series of else/if with the above to map the different rank values.
    if (a > b) {
       xfa.host.messagebox("You cannot select a lower officer as the rating officer");

  • How to 'Only' allow Numeric value in the Edit Box in AcroDialogs

    Hi all,
    I've create an AcroDialog wizard, I need to allow onlu numeric values in the Edit Box. Can someone please help me with this validation?
    Regards,
    Chris

    There isn't a keystroke event for custom JavaScript dialogs, or any proper interactive events for the fields.  You can validate fields when the user presses OK, and you can test fields when the user changes focus by setting the "Action" property for the field.  But the only practical way to restrict user input to numbers is to use George's suggestion.  There is a number property for the fields but it has an undesirable side affect and I never use it.
    Thom Parker
    The source for PDF Scripting Info
    pdfscripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    http://www.adobe.com/devnet/acrobat/javascript.html
    Then most important JavaScript Development tool in Acrobat
    The Console Window (Video tutorial)
    The Console Window(article)

  • Non numeric value in numeric field giving error

    Hi All
    I am using BAPI for creating sales order. If user is giving non numeric value in Quantity field it is giving error. Because quantity field data type is Double.
    Please Help.
    Thanks
    Raktim

    Hi Banerjee,
                 Create a String/int/long Context variable and point it to UI Input element.Do the validation  for correct input value. once the validation is succesful assign that value to RFC BigDecimal variable by Explicit casting.
    Hope this might solve your problem .
    Thanks
    Madhan

  • How do I keep fields hidden until a numeric value is entered including 0

    I have a field that keeps other fields hidden until a numeric value is entered into it...
    My current script is:
    var showHide = event.target.value > 0
    ? display.visible : display.hidden;
    this.getField("Increase DecreaseRow1").display = showHide;
    this.getField("Amended BudgetRow1").display = showHide;
    And it works except when a "0" amount is entered, the fields remain hidden. I need to allow the "0" amount to unhide the fields so, I've tried changing it to:
    var showHide = event.target.ValueAsString != ""
    ? display.visible : display.hidden;
    this.getField("Increase DecreaseRow1").display = showHide;
    this.getField("Amended BudgetRow1").display = showHide;
    but that makes the fields I want hidden visible, even without an entry.
    Any ideas?
    I'm using Adobe Acrobat XI Pro.
    Thanks in advance for any help!

    I use the custom JavaScript validation of:
    if(event.value == 0) event.value = "";
    for the field with the calculation. If one uses a currency symbol or the percentage format then additional coding is needed to set the format to a number without the currency symbol for zero values and the desired format for the currency or percentage.

  • How to restrict the user to enter only numeric values in a input field

    How to restrict the user to enter only numeric values in a input field.
    For example,
    i have an input field in that i would like to enter
    only numeric values. no special characters,alphabets .
    reply ASAP

    Hi Venuthurupalli,
    As valery has said once you select the value to be of type integer,once you perform an action it will be validated and error message that non numeric characters are there will be shown. If you want to set additional constraints like max value, min value etc you can use simple types for it.
    On the project structure on left hand side under local dictionary ->datatypes->simple types create a simple type of type integer
    The attribute which you are binding to value property ;make its type as simple type which you made
    Hope this helps you
    Regards
    Rohit

  • How can I force an "invisible" object to become "visible" when a numeric value is entered?

    So I’m trying to force an “invisible” subform to switch to “visible” when a numeric value greater than or equal to 22 is input into a numeric field.
    I can’t get the following javascript code to work properly with any event. I’ve tried the change, calculate, validate, events and a few more to no avail. The only event that kind of works with the javascript code I’m using is the validate event. When I input the code into the validateevent, the invisible subform becomes visible when an amount equal to or greater than 22 is entered, but when ANY amount is input into this field, an error message pops up that says “NumericField4 validation failed” and the user has to click “Ok” to get rid of the pop up box.
    if (this.rawValue <= 22) {
            Approval23.presence = "hidden";
    if (this.rawValue >= 23) {
                Approval23.presence ="visible";
     Here’s a link to my .pdf: http://www.filedropper.com/salgovform
    The object field that the javascript code is contained in is called: NumericField4 (a.k.a. New Job Grade)
    The subform that I want to become visible when a number greater than 22 is input into NumericField4, is called Approval23.
    I’ve based the javascript code I used on information I gathered from the following thread and associated .pdf . . .
    Thread:
    http://forums.adobe.com/message/1982919
    PDF in thread with the javascript code:
    http://forums.adobe.com/servlet/JiveServlet/download/1981437-8059/Sample_SW.pdf
    I’m pretty sure I’m just missing one little thing that’s throwing everything off!
    Any help would be GREATLY appreciated.

    Hi,
    The following works in the exit event of the numeric field, where the language is set to JavaScript:
    if (this.rawValue <= 22) {
         Approval23.presence = "hidden";
    else {
         Approval23.presence = "visible";
    Here is your form: https://acrobat.com/#d=3gRNt6WBY2bE0K7en4CnSA
    Hope that helps,
    Niall

  • Limiting entry in a JTextField to numeric value and "%" value

    Hi,
    I want to allow the user to enter numeric value and % value
    How can I limit the user to make such a entry in JTextField

    Use the code given below to make your textfield accept only numeric values. You can modify itto include % values too.
    textField.setDocument( new TextFieldVerifier() );     
    class TextFieldVerifier extends PlainDocument {
    public void insertString( int offset, String str, AttributeSet attSet ) throws BadLocationException {           
    boolean valid = false;          
    if ( str == null ) {
    return;
    String old = getText( 0, getLength() );
    /* insert the new string at the given offset, into the old string */     
    String newStr = old.substring( 0, offset ) + str + old.substring( offset );
    try {
    /* check if the new string is a valid integer */
    Integer.parseInt( newStr );               
    valid = true;
    } catch ( NumberFormatException ne ) {          
    /* invalid, if not an integer */
    valid = false;
    Toolkit.getDefaultToolkit().beep();           
    if ( valid ) {
    super.insertString( offset, str, attSet );
    }

  • Function module to validate numeric values

    Hi all.
    Can some one please tell me Is there any Function Module to validate only numeric values?
    Like in year variable, it can never contain alphanumeric values or special symbols?
    Is there any function module to check, wheather the variable contains only numeric values, no alphanumeric value or special symbol?
    If there is no as such function module then what is the alternative approach we can take?
    Plz help me .
    Regards
    Dipankar

    Function Module NUMERIC_CHECK for Editing and checking numeric fields ( i.e. Num validations)
    Check using the Function Module "NUMERIC_CHECK".
    CALL FUNCTION 'NUMERIC_CHECK'
    EXPORTING
    STRING_IN = X
    IMPORTING
    STRING_OUT = X
    HTYPE = H_TYPE.
    if h_type = 'CHAR'.
    WRITE:/ 'Not Numeric'.
    else.
    write:/ 'Numeric'.
    ENDIF.
    REWARDS IF USEFUL
    GAURAV J.
    Edited by: GAURAV on Feb 3, 2008 2:19 PM

  • Form error Invalid numeric value 06-Jun-13 for column FECHA_CAPTURA

    hi,
    i have an APEX form that updates a table. The form items were created autmatically from the table fields. The 3rd field is a date field and therefore the corresponding date field on the form has a calender icon on its right side. i choose a date from this calender and when i hit the update button i receive this message:
    Invalid numeric value 06-Jun-13 for column FECHA_CAPTURA
    any ideas?

    Hi,
    Could we get you to change 1010319 to a meaningful handle -- I'm Howard.
    In order to give helpful answers, we usually need more information including as much relevant information as possible upfront. This should include:
    Full APEX version
    Full DB/version/edition/host OS
    Web server architecture (EPG, OHS or APEX listener/host OS)
    Browser(s) and version(s) used
    Theme used
    Template(s) used / modified -- (Revelant/important for some problems.)
    Region/item type(s)
    and more detail about what you want to do.
    Are you using ARP (Automatic Row Processing)?
    Do you do any validations?
    Could you make a trival 1-page application on apex.oracle.com duplicating the problem there?
    Howard

Maybe you are looking for

  • IF statement in Calculated Field for Share point, doesnt calculate sum in my Excel Pivot table.

    Hi Everyone I used this in SP calculated column field. =IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift Sched]="6pm

  • Unable to generate Dynamic PDF

    Hi, I created a xdp file from xml and xsl files and then used Form Server to generate dynamic pdf file. The xdp file has lot of javascript. The pdf file generated by form server does not change colors of labels of the fields, when incorrect values ar

  • Using PSE as a document management system

    I used a program on my old computer with Windows Vista to file and organize scanned pdf documents. I could readily assign tags to a document, and then find the document using the tags. The tagging worked well. It was quick and intuitive. I now have a

  • Transfer of G/L items

    Hi Experts, At the time of invoice posting, the tax amount is debited to a G/L Account.  My requirement is when the payment is made for an invoice, the tax amount to be transferred to another G/L Account from first G/L account.  This should be either

  • Premiere Pr0 CS6 Flashing Single Video Frame

    In my timeline I am setting in and out points in the viewing browser. I then drag and drop them into the timeline and butt them against another clip. Every couple clips that I rearange seem to be altered. The clip that is moved now has a single frame