Validate user input

How do I validate the data that the user inputs through the prompts? Example: End date is not earlier than start date, or End Date - Start Date <= 12 months?
Any direction is appreciated

Denzil,
One way to "validate" the data would be to populate a back-end table that has the combinations of data you want users to invoke as they run a report.  Another way would be to set up an alerter in the report and when the undesired condition is met than a cell would show up stating the problem, but this solution appears after the report runs and is handled within the reporting tool.  Not very easy answers, just some choices for you to think about.
Thanks,
John

Similar Messages

  • Validate user input in textfield?

    Am trying validate user input into my JTextfield but its not working right... Am using the classes from sun's hp :
    http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html
    The classes with changes made:
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.Toolkit;
    import java.text.*;
    public class DecimalField extends JTextField
    private NumberFormat format;
    private NumberFormat percentFormat;
    public DecimalField()
    super(10);
    percentFormat = NumberFormat.getNumberInstance();
    percentFormat.setMinimumFractionDigits(2);
    // ((DecimalFormat)percentFormat).setPositiveSuffix(" ");
    setDocument(new FormattedDocument(percentFormat));
    format = percentFormat;
    public double getValue()
    double retVal = 0.0;
    try
    retVal = format.parse(getText()).doubleValue();
    } catch (ParseException e)
    Toolkit.getDefaultToolkit().beep();
    return retVal;
    public void setValue(double value)
    setText(format.format(value));
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.Toolkit;
    import java.text.*;
    import java.util.Locale;
    public class FormattedDocument extends PlainDocument
    public FormattedDocument(Format f)
    format = f;
    public Format getFormat()
    return format;
    public void insertString(int offs, String str, AttributeSet a)
    throws BadLocationException
    String currentText = getText(0, getLength());
    String beforeOffset = currentText.substring(0, offs);
    String afterOffset = currentText.substring(offs, currentText.length());
    String proposedResult = beforeOffset + str + afterOffset;
    try
    format.parseObject(proposedResult);
    super.insertString(offs, str, a);
    } catch (ParseException e)
    Toolkit.getDefaultToolkit().beep();
    // System.err.println("insertString: could not parse: "
    // + proposedResult);
    public void remove(int offs, int len) throws BadLocationException
    String currentText = getText(0, getLength());
    String beforeOffset = currentText.substring(0, offs);
    String afterOffset = currentText.substring(len + offs,
    currentText.length());
    String proposedResult = beforeOffset + afterOffset;
    try
    if (proposedResult.length() != 0)
    format.parseObject(proposedResult);
    super.remove(offs, len);
    } catch (ParseException e)
    Toolkit.getDefaultToolkit().beep();
    // System.err.println("remove: could not parse: " + proposedResult);
    private Format format;
    what am I doing wrong?

    am sorry
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.Toolkit;
    import java.text.*;
    import java.util.Locale;
    public class FormattedDocument extends PlainDocument
        public FormattedDocument(Format f)
            format = f;
        public Format getFormat()
            return format;
        public void insertString(int offs, String str, AttributeSet a)
        throws BadLocationException
            String currentText = getText(0, getLength());
            String beforeOffset = currentText.substring(0, offs);
            String afterOffset = currentText.substring(offs, currentText.length());
            String proposedResult = beforeOffset + str + afterOffset;
            try
                format.parseObject(proposedResult);
                super.insertString(offs, str, a);
            } catch (ParseException e)
                Toolkit.getDefaultToolkit().beep();
    //            System.err.println("insertString: could not parse: "
    //            + proposedResult);
        public void remove(int offs, int len) throws BadLocationException
            String currentText = getText(0, getLength());
            String beforeOffset = currentText.substring(0, offs);
            String afterOffset = currentText.substring(len + offs,
            currentText.length());
            String proposedResult = beforeOffset + afterOffset;
            try
                if (proposedResult.length() != 0)
                    format.parseObject(proposedResult);
                super.remove(offs, len);
            } catch (ParseException e)
                Toolkit.getDefaultToolkit().beep();
    //            System.err.println("remove: could not parse: " + proposedResult);
        private Format format;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.Toolkit;
    import java.text.*;
    public class DecimalField extends JTextField
        private NumberFormat format;
        private NumberFormat percentFormat;
        public DecimalField()
            super(10);
            percentFormat = NumberFormat.getNumberInstance();
            percentFormat.setMinimumFractionDigits(2);
    //        ((DecimalFormat)percentFormat).setPositiveSuffix(" ");       
            setDocument(new FormattedDocument(percentFormat));
            format = percentFormat;
        public double getValue()
            double retVal = 0.0;
            try
                retVal = format.parse(getText()).doubleValue();
            } catch (ParseException e)
                Toolkit.getDefaultToolkit().beep();
            return retVal;
        public void setValue(double value)
            setText(format.format(value));
    }Well when I create this overriden TextField ( DecimalField ) its working as it should with the first character. Its only accepting digits and . but after the first character its accepting everything. Its like the validation disappear?

  • How to validate user input

    Hi,
    I am new to Form design
    I am designing an offline form I just want to validate the user input
    whether user has entered Character or Numric.
    if user enters characters in phone no I have to give an error message.
    can you please give the pice of the script to validate the user input.
    Regards
    Bikas

    Instead of finding what is the type of input, you can restrict the user not to type characters in Phone No field.
    Place the below code in Change event of the Phone No field with Java Script as language. 
    // restrict entry to digits
    if (xfa.event.change.match(/[0-9]/) == null)
         xfa.event.change = "";
    Note: You have placed the question in the wrong forum.. You might need the Designer ES forum.
    Thanks
    Srini

  • How to validate user input field?

    I need to validate a user input field against a table. This field is not part of an EO but is used to update an attribute on an existing EO.
    My question is, where would I place the sql that would validate the user input value against the table?
    Is there an easy way to do this?
    I'm at a roadblock and really need some help. Thank you.

    You can execute a sql query or a function from <your>AMImpl.java, using normal jdbc.
    but I would recommend this, it is easier and cleaner approach
    1. Create a VO (<your>VO) with the sql statement
    Select client
    from client_table
    where resp_id = :1
    and client= :2
    2. Add this vo to the am
    3. In AMImpl, get handle to the VO (this.get<your>VO1)
    4. Bind params
    this.get<your>VO1().setWhereClauseParams(0,current_resp );
    this.get<your>VO1().setWhereClauseParams(1,user_input_value);
    5. Execute the query
    this.get<your>VO1().executeQuery();
    6. Get the row after the query is executed
    oracle.jbo.Row <your>Row = this.get<your>VO1().first();
    7. Get the value of the attribute from the row
    l_client = <your>Row.getAttribute("Client") ;
    8. So now you have what you wanted to do with the sql.
    Thanks
    Tapash

  • Validate user input String

    I dunno why I cant get this to work,
    Im getting user input from JOptionPanes, and need to create an error message each time that nothing is entered, I tried creating a method to validate this, but couldnt get it too work, do I need to use the OnClick event handler???
    This is my code, thanks
    billsName = JOptionPane.showInputDialog("Please enter the Bill Name:");
    tomName = JOptionPane.showInputDialog("Please enter the Tom:");
    sandyNameLoc = JOptionPane.showInputDialog("Please enter the Sandy:");

    this is the way that I had the validation, but nothing happens, when I tyoe nothing in, it just goes to teh next input box
    fName = JOptionPane.showInputDialog("Please enter your First Name:");
    if(fName ==null)
    JOptionPane.showMessageDialog(null, "Eror", "Eror", JOptionPane.ERROR_MESSAGE);
    }

  • Captivate 6 How to validate user input without using keyboard shortcuts

    I've been using Adobe Captivate 6 for about 4 months now.  Completely new to the program.  The number one function of Captivate for me will to create many software simulations for verifiable training.  This means that I will be utilizing the training and assessment modes A LOT.  I have run into many hurdles throughout the process, but one of my biggies right now is this:
    In the training and assessment modes, I have times where the user must input data such as an address or number.  In the actual software they will be utilizing it is not always required to use TAB or ENTER in order to move to the next field.  In some instances, it will be necessary to actually click into a field after entering data.  My problem is that it seems as if Captivate will not allow this,  as a keyboard shortcut is automatically entered even if a TAB or ENTER is not required after input.  I assume this is so that the inputted information can be verified.  If you decide you do not want to use a keyboard shortcut to validate the inputted information, you must have a submit button.  Is there any way to change this??  All I want is for the user to enter information and then click into another field WITHOUT having to press ENTER, TAB, or hit a submit button.  Is this even possible if you need user input to be validated??  Any ideas or suggestions would be much appreciated!!

    Hello,
    A while ago I explained the work flow I’m using often in that case, only for the last field you need to have either a shortcut or a submit button AND the sequence has to be imposed. The idea is that you make the Submit button for the first field transparent, delete the  ‘Submit’ text and put it over the second field. So if the user clicks on the second field, he also submits the value of the first field.
    Here is the blog post I’m referring to:
    http://lilybiri.posterous.com/one-submit-button-for-multiple-text-entry-box
    Although it was written for previous versions, the idea will still be functional.
    Lilybiri

  • Where to validate user input from FPM_FORM_UIBB?

    I am supporting an ESS OVP app using WDA and FPM. 
    This question concerns validating/changing user input from an edit page entered through FPM_FORM_UIBB
    In a form, on an edit page, we wanted to mask the initially loaded value of a field with asterisks.
    I used the feeder class get_data() method to accomplish this.
    The user may then overtype the asterisks with content data.  At times, the user leaves some of the asterisks there as well.
    I want to check the contents of the inpu field, and, if needed, compress out the asterisks.
    if not inputfield co '* ' .
    translate inputfield using '* ' .
    condense inputfield NO-GAPS .
    endif .
    Where can I put this code? Or, where, generally, do you code validations of form data?
    Thanks…  
    …Mike

    Hi Mark,
    You should be able to catch the event in PROCESS_EVENT and GET_DATA. I would put the break-point in both of these methods and check for the field values and based on that decide course of action. So steps would be.
    1) Put in the break-points in the obove methods.
    2) Check the event and the field values you are intrested in.
    3) Code accordingly.
    Hope it helps.
    Laeeq Siddique

  • Where to validate user input

    hi all,
    I have following problem:
    When user submits form, all the data in request are Strings. Now suppose I need to put this data in database using TransferObject and DAO. My question is how to do it properly? I think about two ways of doing that:
    1)
    Create TransferObject with all properties being Strings or arrays of Strings, and then let DAO classes take care about validation of data format and type conversion. In this case all I need to do in my servlet is to create TransferObject, fill it with form data without any validation and then pass this object to DAO. Then DAO makes all conversions, and either adds new record or raises format exception.
    2)
    Create TransferObject with different types of properties according to database fields types. Then DAO get's valid data and all it needs to do is to put it in database. But then I have to take care about validation in my servlet to pass valid data to DAO.
    This way has at least one disadvantage for me: I think I can't use any utilities copying all properties from form to TransferObject.
    So tell me which way should be used to have right aplication design.
    Thanks for all replies.

    IMO, the database should concern itself with data integrity and referential integrity. It will validate the data type, precision and scale you are attempting to insert or update. It will also enforce referential constraints (e.g., primary keys, foreign keys, unique constraints, etc.) that may exist on the table(s). Finally, the database is responsible for ensuring a transaction is atomic, either the whole logical unit of work will be committed or the changes rolled-back successfully.
    More complex validations (e.g., account balance cannot be negative unless savings account balance is greater than $1,000) should generally be done in the middle-tier, though an argument can be made that even these validations can also be put in the database.
    Generally, for complicated transactions, the middle-tier will be responsible for transaction management. This is not a minor responsibility in a complicated set of data updates. The middle-tier will also enforce workflow and/or data sufficiency (e.g., even though a column may be nullable in the database, a business rule may require the value be specified).
    Finally, some validation can occur on the client. Though, you should always look at these validations in terms of application response time, not actual data validation. You may want to place some validations on the client so that a server trip is not required for validation. However, all validations must occur in the middle-ware and/or database. You cannot trust client code. Someone might modify the page and resubmit it.
    - Saish

  • Pdf live cycle  form through sap abap editor to validate user input by java script coding

    I am new to apply a java script in a Adobe form.
    So i need of help that i have 9 page form of HR module i need to verify every blank field and wrong entry field also.
    I look around a lot of code but still i am not able to perform good validation in a Adobe form.
    I am using SAP ABAP editor where i am making through PDF Live cycle FORM & try to put java script validation on the field.
    My problem is that how can i link or configured to Adobe form.
    Here are some event are given "mouseup","validate" or more are given.So how i can do.
    i wrote the code like
    / Get the field value
    var f1 = this.getField("VORNA");----why it is not working.Some thing is wrong?
    var v1 = f1.valueAsString;
    if (v1) {
    } else {
       app.alert("Field: " + f1.name + " is blank.", 1);
    //above code is not working.
    but here we used rawValue() method it works , but it popup message  javascript with window error.
    if( this.rawValue()==' ' || this.rawValue==null)---------this works
    xfa.host.MessageBox("First name is blank!");---------this works
    "VORNA" is "First name" field name binding with this value.
    How we can linked java script file with Adobe form.
    Kindly help me

    You're mixing code for an acroform with code for an XFA form. SInce you're creating the form with LiveCycle Designer, it wold be better if you posted this to the LiveCycle Designer forum, if you haven't already.

  • Pdf live form through sap abap editor to validate user input by java script coding

    I am new to apply a java script in a Adobe form.
    So i need of help that i have 9 page form of HR module i need to verify every blank field and wrong entry field also.
    I look around a lot of code but still i am not able to perform good validation in a Adobe form.
    I am using SAP ABAP editor where i am making through PDF Live cycle FORM & try to put java script validation on the field.
    My problem is that how can i link or configured to Adobe form.
    Here are some event are given "mouseup","validate" or more are given.So how i can do.
    i wrote the code like
    / Get the field value
    var f1 = this.getField("VORNA");----why it is not working.Some thing is wrong?
    var v1 = f1.valueAsString;
    if (v1) {
    } else {
       app.alert("Field: " + f1.name + " is blank.", 1);
    //above code is not working.
    but here we used rawValue() method it works , but it popup message  javascript with window error.
    if( this.rawValue()==' ' || this.rawValue==null)---------this works
    xfa.host.MessageBox("First name is blank!");---------this works
    "VORNA" is "First name" field name binding with this value.
    How we can linked java script file with Adobe form.
    Kindly help me.

    You're mixing code for an acroform with code for an XFA form. SInce you're creating the form with LiveCycle Designer, it wold be better if you posted this to the LiveCycle Designer forum, if you haven't already.

  • How to validate user inputs against checktables

    Hi all,
    how to validate userinputs for s_bukrs and s_hkont  against respective check tables(t001 and skb1).
    can u pl zprovide me codeing for this validations.
    very urgent.
    thanks in advance
    swathi

    Hi
    Write the report
    REPORT ZREPORT.
    tables: t001,skb1,
    select-options: s_bukrs for t001-bukrs,
                           s_hkont for skb1-saknr.
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_screen.
    *&      Form  validate_screen
    Validation of Selection Screen fields
    FORM validate_screen .
    Validation of Company code
      CLEAR t001-bukrs.
      IF NOT s_bukrs[] IS INITIAL.
        SELECT bukrs UP TO 1 ROWS
            INTO t001-bukrs
            FROM t001
            WHERE bukrs IN s_bukrs.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Company code'(002).
        ENDIF.
      ENDIF.
    Validation of Account Number
      CLEAR skb1-SAKNR.
      IF NOT s_SAKNR[] IS INITIAL.
        SELECT SAKNR  UP TO 1 ROWS
            INTO skb1-SAKNR
            FROM skb1
            WHERE SAKNR IN s_SAKNR and
                         bukrs    in S_BUKRS.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Account Number'(003).
        ENDIF.
      ENDIF.
    ENDFORM.
    Reward points if useful
    Anji

  • Validate User Input. If lastname is entered then set Email required.

    Hello Gurus,
    I have a business requirement when creating a Customer contact information. The requirement is when a user enters the contact's lastname and does not enter a value in the contact's email filed then throw an error message after clicking the Apply Button.
    I am trying to do this my extending HzPuiQuickCreatePersonSpecialCO controller with the following code but it doesn't do anything. What am I doing wrong? Please help!:
    package xxf5.oracle.apps.ar.hz.components.party.person.webui;
    import oracle.apps.ar.hz.components.party.person.webui.HzPuiQuickCreatePersonSpecialCO;
    import oracle.apps.fnd.framework.OAApplicationModule;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.OAViewObject;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.jbo.Row;
    public class XXF5HzPuiQuickCreatePersonSpecialCO extends HzPuiQuickCreatePersonSpecialCO
    public void processFormRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
    super.processFormRequest(oapagecontext, oawebbean);
    if(oapagecontext.getParameter("applyBtn") != null)
    OAApplicationModule oaapplicationmodule = oapagecontext.getApplicationModule(oawebbean);
    OAViewObject LastNameVo;
    LastNameVo = (OAViewObject)oaapplicationmodule.findViewObject("HzPuiPerQuickCreateProfileVO");
    Row rowLastName;
    rowLastName = LastNameVo.getCurrentRow();
    OAViewObject EmailVo;
    EmailVo = (OAViewObject)oaapplicationmodule.findViewObject("HzPuiPerQuickCreateEmailVO");
    Row rowEmail;
    rowEmail = EmailVo.getCurrentRow();
    if(rowLastName.getAttribute("PersonLastName").toString() != null
    && rowEmail.getAttribute("EmailAddress").toString() == null)
    throw new OAException("Email is Required.", OAException.ERROR);
    }

    I changed my code to the following but it still doesn't do anything. :-( Please help
    package xxf5.oracle.apps.ar.hz.components.party.person.webui;
    import oracle.apps.ar.hz.components.party.person.webui.HzPuiQuickCreatePersonSpecialCO;
    import oracle.apps.fnd.framework.OAApplicationModule;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.OAViewObject;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.jbo.Row;
    public class XXF5HzPuiQuickCreatePersonSpecialCO extends HzPuiQuickCreatePersonSpecialCO
    public void processFormRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
    super.processFormRequest(oapagecontext, oawebbean);
    if(oapagecontext.getParameter("Apply") != null)
    OAApplicationModule oaapplicationmodule = oapagecontext.getApplicationModule(oawebbean);
    OAViewObject LastNameVo;
    LastNameVo = (OAViewObject)oaapplicationmodule.findViewObject("HzPuiPerQuickCreateProfileVO");
    Row rowLastName;
    rowLastName = LastNameVo.first();
    OAViewObject EmailVo;
    EmailVo = (OAViewObject)oaapplicationmodule.findViewObject("HzPuiPerQuickCreateEmailVO");
    Row rowEmail;
    rowEmail= EmailVo.first();
    if(rowLastName.getAttribute("PersonLastName") != null && !rowLastName.getAttribute("PersonLastName").equals("")
    && rowEmail.getAttribute("EmailAddress").toString() == null)
    throw new OAException("Email is Required.", OAException.ERROR);
    }

  • [Newbie] When to validate user input in a task form

    Hi.
    Suppose you have a task with two integers as payload (x, y) and two possible outcomes, say I_LIKE_X and I_LIKE_Y.
    Business logic requires that if I_LIKE_X then must be X > 0 and Y <= 0, else if I_LIKE_Y then must be X <= 0 and Y > 0.
    In this scenario I cannot use validators at task data control level because input correctness depends on the outcome.
    So, how would you deal with such a scenario?
    You will put validation
    1. at UI level (action listeners, partial triggers, ...) to prevent task completion submission in case of errors.
    2. at BPEL level: after task completion, check outcome+variables consistency and reinitiate task if needed.
    That is: business fault prevention (1) or detection (2)?
    Thanks in advance,
    Michael

    Hi.
    Suppose you have a task with two integers as payload (x, y) and two possible outcomes, say I_LIKE_X and I_LIKE_Y.
    Business logic requires that if I_LIKE_X then must be X > 0 and Y <= 0, else if I_LIKE_Y then must be X <= 0 and Y > 0.
    In this scenario I cannot use validators at task data control level because input correctness depends on the outcome.
    So, how would you deal with such a scenario?
    You will put validation
    1. at UI level (action listeners, partial triggers, ...) to prevent task completion submission in case of errors.
    2. at BPEL level: after task completion, check outcome+variables consistency and reinitiate task if needed.
    That is: business fault prevention (1) or detection (2)?
    Thanks in advance,
    Michael

  • Validate user input with the screen flow logic.

    Hello guys, im facing some troubles with the following code
    field mara-matnr SELECT *
                        from mara
                        into table itab_mara
                        where  matnr = mara-matnr
                        and  matnr = mara-matkl
                        WHENEVER NOT FOUND SEND ERRORMESSAGE 107
                                   WITH  mara-matnr .
    the editor doest recognize this code in PAI., is the same with VALUES clause. 
    what im doing wrong ? . thank you very mch.

    Hi,
    Please check code in where condition. Is the condition is right?
    field mara-matnr SELECT *
                        from mara
                        into table itab_mara
                        where  matnr = mara-matnr
                        and  matnr = mara-matkl
                        WHENEVER NOT FOUND SEND ERRORMESSAGE 107
                                   WITH  mara-matnr .
    MATNR is comparing with MATNR and also MATKL.
    When you are doing the valiation make sure that use the chain and endchain stamt.
    PAI
    CHAIN:
    MODULE VALI_DATA.
    END CHAIN.
    Like above do the code.

  • Checking/Validating user input in a text field

    How can I validate a user's input in a text field and require them to input it in the following format:
    AAA 9999-999
    (where A can be letters and 9 can be numbers)
    Is there any documentation on how to validate user inputs in this manner?
    Thanks!
    BoilerUP

    Hi,
    Create a validation PL/SQL process, select Function returning Error and use something similar to the example below.
    I tested it but may be I missed something. I used field name P1_TEST.
    DECLARE
    v_number NUMBER;
    v_error VARCHAR2(1000);
    BEGIN
    --check if you have numbers in positions 5-8 and 10-12
    v_number:=SUBSTR(:P1_TEST,5,4);
    v_number:=SUBSTR(:P1_TEST,10);
    --check string length
    IF LENGTH(:P1_TEST)!=12 THEN
    RETURN 'String length must be 12 characters';
    END IF;
    --check if position 4 is empty
    IF INSTR(SUBSTR(:P1_TEST,4,1),' ')=0 THEN
    RETURN 'There should be a space between letters and numbers';
    END IF;
    --check if position 9 has "-"
    IF INSTR(SUBSTR(:P1_TEST,9,1),'-')=0 THEN
    RETURN 'There should be a dash between numbers';
    END IF;
    --check if positions 1-3 has letters
    FOR i IN 1 .. 3 LOOP
    SELECT ascii(substr(:P1_TEST, i, 1)) INTO v_number
    FROM Dual;
    IF v_number>=48 AND v_number<=59 THEN
    RETURN 'Only letters are allowed in positions 1,2,3';
    END IF;
    END LOOP;
    RETURN NULL;
    EXCEPTION
    WHEN OTHERS THEN
    v_error:=SQLERRM;
    IF INSTR(v_error, 'ORA-06502')>0 THEN
    RETURN '...must be integers only';
    ELSE
    RETURN v_error;
    END IF;
    END;
    I hope it will give you an idea on this type of validation.
    Val

Maybe you are looking for