Validate 2 fields

I have two fields I need to have validated (equipment and serial numbers). Once those are filled out the user will use a dropdown(tonnage) to select a number that will return them a specified dollar amount (working fine). My issue is validating those two fileds and if they are not filled out the dropdown needs to be blank. I have the following code that I believe to be correct. I am calling this function in the validate section of the dropdown field and NOTHING is happening. I'm at my whits end  - any suggestions are helpful.
function getEquip() {
    var rowName = event.target.name;
    var rowNum = rowName.substr(rowName.length - 5, 5);
    if (this.getField("Equipment Description" + rowNum).value == " " && this.getField("Equipment Serial" + rowNum).value == " ") {
      this.getField("Unit Tonnage" + rowNum).value = " ";
    if (this.getField("Equipment Description" + rowNum).value == " ") {
        app.alert('Please enter an equipment description');
    if (this.getField("Equipment Serial" + rowNum).value == " ") {
        app.alert('Please enter an equipment serial number');
Image of PDF

I checked the box that commits the selection.
I'm not sure about accessing 'event.value' to check the value of the field. The dropdown operates on a different code (below) and that part is working perfectly. It's just the checking part that won't work.
function getIncentives() {
var rowName = event.target.name;
var rowNum = rowName.substr(rowName.length-5,5);
var tons = this.getField("Unit Tonnage" + rowNum).value;
if (tons == "4") {
  this.getField("Incentive" + rowNum).value = 250;
if (tons == "5") {
  this.getField("Incentive" + rowNum).value = 250;
if (tons == "6") {
  this.getField("Incentive" + rowNum).value = 265;
if (tons == "7.5") {
  this.getField("Incentive" + rowNum).value = 287;
if (tons == "8") {
  this.getField("Incentive" + rowNum).value = 295;
if (tons == "9") {
  this.getField("Incentive" + rowNum).value = 310;
if (tons == "10") {
  this.getField("Incentive" + rowNum).value = 325;
if (tons == "11") {
  this.getField("Incentive" + rowNum).value = 340;
if (tons == "12.5") {
  this.getField("Incentive" + rowNum).value = 362;
if (tons == "15") {
  this.getField("Incentive" + rowNum).value = 400;
if (tons == "17.5") {
  this.getField("Incentive" + rowNum).value = 437;
if (tons == "20") {
  this.getField("Incentive" + rowNum).value = 475;
if (tons == "25") {
  this.getField("Incentive" + rowNum).value = 550;
if (tons == "30") {
  this.getField("Incentive" + rowNum).value = 625;
if (tons == "35") {
  this.getField("Incentive" + rowNum).value = 700;
if (tons == "40") {
  this.getField("Incentive" + rowNum).value = 775;
if (tons == " ") {
  this.getField("Incentive" + rowNum).value = "";

Similar Messages

  • How to validate the field values in module pool program?

    Hi Guys
         I am working with module pool programming.
         Here I want to validate the fields like below.
         with out filling all the fields if I click SAVE option it has to show a message that all fields has to be filled.  This can be done by checking all the fields individually.
         I think it can be done through <b>LOOP AT SCREEN ......ENDLOOP</b>. sequence.
         If it is possible, can anyone help me?

    You need to write the Module in between the CHAIN and ENDCHAIN statment in SE51
    If you send a warning or error message from a module <mod> that you called using a FIELD statement as follows:
    CHAIN.
    FIELD: <f1>, <f 2>,...
    MODULE <mod1>.
    FIELD: <g1>, <g 2>,...
    MODULE <mod2>.
    ENDCHAIN.
    all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again. Other fields are not ready for input. Whenever the MODULE statement appears within a processing chain, even if there is only one FIELD attached to it, all of the fields in the chain (not only the affected field) are made ready for input again, allowing the user to enter new values. If the fields in the processing chain are only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.
    Look at the DEMO program DEMO_DYNPRO_FIELD_CHAIN.
    ashish

  • I have to validate the field enter in that table  values is enter in the ra

    i have one table field with data
    1. <=0.5
    2. <=1
    3.textsfsfs
    4. >=2 like that
    i have to validate the field enter in that table  values is enter in the range of the above field.
    can you help me how to validate
    ex:
    if wa-upper =  wa2-sumplus  here i have to check the upper and lowe values
    if the user enter in between and eq based on the i have to give erro message.
    Please help me the same.
    Thanks
    Ramkumar

    Hi Lekha,
    Thank you this problem was solve.
    we did the this validation in back end insted of front end.
    i passed the table data in to ZFM there we are validating and giving the error message.
    thank you for helping me all the time.
    ONE problem:
    LV_TEXT is the context attribut containe type string.
    i amgetting the values in to LV_TEXT attribut.
    LV_TEXT = nkafjkafkafhkafksfkak<b>#</b>bshfsafkasfkasfkas.
    i wanto to split this and will get the before <b>#</b> values in to other other node workarea LS_dis_new.
    this LS_DIS_NEW i have to modify with table LT_DIS_NEW.
    i used the code : Split wa at '#' into table LT_DIS_NEW.
    this is not working.
    please help me the same.
    Thanks
    Ramkumar

  • How to validate the field when i am populating the data cursor to block

    Hi,
    I am populating data cursor to multi record block.
    Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
    If user enter negative values and decimal points in quantity filed i need to display message to user item level.
    Please do the needful how to do it.

    902434 wrote:
    Hi,
    I am populating data cursor to multi record block.
    Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
    If user enter negative values and decimal points in quantity filed i need to display message to user item level.
    Please do the needful how to do it.If you want to validate at entry level then use When-Validate-Item trigger and check the input and show message. Like
    If :quentity <0 then
    message('do not enter negative value');
    message('do not enter negative value');
    raise form_trigger_failure;
    end if;Why u open same thread again ? not closing one.. check this one
    </a>
    How to validate the field when i am populating the data cursor to block
    Hopes this helps
    If someone's response is helpful or correct, please mark it accordingly.

  • How do we validate input fields on the selection screen

    How do we validate input fields on the selection screen

    hi balram,
    u can validate input fields using <b>AT SELECTION-SCREEN</b>  Event.
    PARAMETERS : p_werks TYPE marc-werks.
    AT SELECTION-SCREEN ON p_werks.
    SELECT SINGLE *
    FROM t001w
    WHERE werks = p_werks.
    IF sy-subrc <> 0.
    MESSAGE 'Invalid Plant' TYPE 'I'.
    ENDIF.
    Like this, we can validate user input for plant.
    check this link:
    http://help.sap.com/saphelp_nw04s/helpdata/en/9f/db9a2e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
    Reware me if useful......
    Harimanjesh AN

  • How to validate a field of type text for similar values

    Hi,
    My requirement is to validate a field <b>Name1</b> of type Text[40] for similar values when a new record is created. So If the Name1 already exist in repository, the validation has to give warning message saying the customer with Name1 already exist.
    Regards,
    Madhu

    Hi Madhu
    To validate a particular field, when a new record comes along with the same value SAP MDM is not capable of generating warning messages, but we can have best method of Tracking at Import manager level.
    In the Import manager after successful mapping, access the MATCH RECORD tab. Go to the Default import action area there you can find Match type & Default import action. For example if you are sending same Material record which is already available in the Repository, Match type will have the value “EXACT” where as Default Import action will have “UPDATE (ALL MAPPED FIELDS or NULL FIELDS)”.
    Here I have copied various Match types as well as Default Import Actions along with the definitions, pls go thru the same and feel free to revert to me for further clarifications.
    <u><b>Default Import Action</b></u>
    <b>Skip -></b> Skip source value combinations that already
            exist.
    <b>Update(NULL Qualifiers Only) -></b>     Update just the NULL remaining qualifiers of each existing qualified lookup value.
    <b>Update (All Mapped Qualifiers)-></b> Update all the remaining qualifiers of each existing
    qualified lookup value.
    <b>Replace -></b> Replace all the remaining qualifiers of each existing qualified lookup value by first deleting them and then creating a new value combination.
    <b>Delete -></b> Delete this qualified lookup value during import Processing.
    <u><b>Match Type</b></u>
    <b>None -></b> None
    <b>Exact -> </b> Whether the match type for the destination record with the current source
    record is Exact.
    <b>Partial -></b> Whether the match type for the destination record with the current source
    record is Partial.
    <b>Conflict -></b> Whether the match type for the destination record with the current source
    record is Conflict.
    Thanks
    Alexander
    Message was edited by: Alexander Raja

  • How to validate input fields as the user is filling up a form with jQuery?

    Hello EA friends.
    Someone has experimented on how to validate input fields as the user is filling up a form with jQuery?, if the field is numeric and insert an A for example, an alert appears showing "insert a number" or not allowed to enter anything until a number is entered.
    Thanks and regards.
    Fer

    Hi Sudeshna.
    Sorry for not responding on time, how can I be included in this code?
    sym.setVariable("typeActivity", "input")
    var Element_1=document.createElement(typeActivity);
    $(Element_1).css({"text-align": "center"});
    //Answer
    sym.setVariable("Answer_1", "4");
    sym.$("box_1").append(Element_1)
    This code is on my creationComplete and it works fine.
    Would greatly appreciate your help.
    Regards.
    Fer García

  • How to validate the fields  and how to display the error messagein presenta

    Hi,
    I am new to OBPM 10g, pls tell me how to validate the fields in a presentation.
    for example if we take login presentation if user enters his user name and password wrongle and submit the form. Then we need to display error message right side of the each field i.e user name and passowrd is wrong and try again.
    Regards
    jaya
    Edited by: 12345 on Aug 12, 2010 10:38 PM

    Hi Jaya,
    You can initially set the validation for empty values.. that is when the user dint enters any value and clicks on submit.
    for these vadliations you need to write a method and call it on submit button click!!
    secondly, you can validate for the format if required.
    thirdly, you can validate against a database for the credentials. For this you need to fetch list of usernames from database and search for user entered value in that list.
    Optimal query would be : if user name not null, query for pwd of the entered user name from database or file storage. if you dont get any value for pwd of given username, its incorrect user name. if you get some pwd value for username, then check against the one user entered in pwd field..
    Write all this logic in a method and call on submit button click event of the login form!!
    HTH
    Sharma

  • How to validate ch field in selection screen

    hi experts.......
    how to validate ch field selection screen......... and which function module is used to validate parameter field i.e character

    Hello,
                Is your requirement to Validate the Character Field? This is what I understand. If it is right, then do you want to Validate whether a Character Value is entered?
                Check the below Sample Code.
    At Selection-Screen on P_CHARFIELD.
        IF P_CHARFIELD CA '1234567890'.
            Message 'Enter an Alpha Character only' Type 'E'.
        Endif.
    Thanks and Regards,
    Venkat Phani Prasad Konduri

  • HOW WE CAN VALIDATE A FIELD THAT SHOULD NOT BE SPECIAL CHARACTER?

    HOW WE CAN VALIDATE A FIELD THAT SHOULD NOT BE SPECIAL CHARACTER?

    data : v_abcde like sy-abcde,
             v_num like '0123456789',
              v_data(60) type c.
    start-of-selection.
    v_abcde = sy-abcde.
    concatenate v_abcde v_num into v_data.
    if ur field co v_data
    else.
    message.
    endif.

  • Enhancement Spot for MM02 to validate a field

    Hi,
    I want to find a enhancement spot for MM02 to validate a field 'SerialNoProfile' in 'sales: General/Plant view'. can any one help me to find a enhnacement spot.
    Thanks in advance.
    Krishna

    hi
       Check these Exits
               MGA00001            Article Master (Industry): Checks and Enhancements
               MGA00002            Article Master (Industry): Number Assignment
               MGA00003            Article Master (Industry and Retail): Number Display
    thanks,
    nagaraj

  • Want to validate a field on screen

    want to validate a field on screen w/o pressing enter after the input is given either thru f4 help or manually.
    Its a normal selection screen it is not a dynpro
    is it possible?
    The customer wants it to be so!!!
    Can i assign user-command to a field on screen?
    please help me asap. all suggestion would be rewarded.
    Regards

    Hi,
       You can do via F4 help validation but for manual enter it is not possible as you need some action.
    Try out The Sample Code for F4
    TYPES: BEGIN OF t_reques,      
           lgnum TYPE lgnum,          
           END   OF t_reques.
    DATA:i_reques TYPE STANDARD TABLE OF t_reques. 
    SELECTION-SCREEN: BEGIN OF BLOCK b1.
      PARAMETER:        p_ware  TYPE lgnum    OBLIGATORY.          
    SELECTION-SCREEN: END   OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ware.
      SELECT lgnum
             FROM T301
             INTO TABLE i_reques.                 
      PERFORM f4_help USING i_reques CHANGING p_ware.    "SUBROUTINE FOR F4 HELP.
          SUBROUTINE FOR F4 HELP.                                        *
         -->P_I_REQUES  text
         <--P_P_WARE  text
    FORM f4_help  USING    p_i_reques
                  CHANGING p_p_ware.
               CALLING FM F4IF_INT_TABLE_VALUE_REQUEST FOR F4 HELP.      *
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          ddic_structure   = 'LINK'
          retfield         = 'LGNUM'
          dynpprog         = sy-repid
          dynpnr           = sy-dynnr
          dynprofield      = 'P_P_WARE'
          callback_program = 'ZTEST'   <<Your Program Name
        TABLES
          value_tab        = i_reques             
        EXCEPTIONS
          parameter_error  = 1
          no_values_found  = 2
          OTHERS           = 3.
      IF sy-subrc <> 0.                          
        MESSAGE i006(zmm_ab).                    
      ENDIF.
    ENDFORM.                                                    " F4_HELP
    Rgds,
    Abhishek

  • To validate the fields within JSP

    Hi,
    I want to make sure that there's a way to validate the fields against the DB using Javascript.
    I remember that using JSP we can run SQL scripts; am I correct or not?
    Thks & Rgds,
    Huamin

    not sure what u r asking for....
    u can validate the data in the database using javascript very easily....
    u can always write SQL queries in JSP but it is not advisable....
    Pls elaborate ur requirement...
    Thanks

  • How can i validate  the field directline under personal information of ESS?

    Hi all,
    How can i validate the field directline under personal information--> communication data  of ESS?The thing is we don't have NWDI setup in our organization.Is there any possibility of doing it under SPRO trn.
    Thanks and Regards,
    sam

    Hi,
    This is probably a wrong forum that you have posted your question to.
    Regards,
    Siddhesh

  • How can i validate a Field so that it can accept only Numbers

    can any one help me to validate a filed so that it accepts only numbers if not alert user (client side JavaScript alert message)
    Iam using JSF and ADF BC as the Technologies in my application ..
    my requirement is to validate a filed so that i can accept only numbers in my jspx page..
    I had used ADF regularExpression Validator do so... but it results in exception
    java.lang.IllegalArgumentException: 'value' is not of type java.lang.String.
         at oracle.adf.view.faces.validator.ValidatorUtils.assertIsString(ValidatorUtils.java:36)
         at oracle.adf.view.faces.validator.RegExpValidator.validate(RegExpValidator.java:103)
         at oracle.adf.view.faces.component.UIXEditableValue.validateValue(UIXEditableValue.java:378)
    <af:validateRegExp pattern="[0-9]*"
    noMatchMessageDetail="Please enter Numbers only"/>
    Using validateRegExp i can only validate a field that accept String type data ..

    Hello experts,
    Am seeing the same problem while trying to validate an inputtext field that can only accept numbers. This input filed is part of a table ..Data expected here is an integer
    since that is what is gotten from my ejb/sent for update to the db.
    <af:inputText value="#{row.daysToReview}"
    required="#{bindings.AdminResultBeanresultBeanArray.attrDefs.days.mandatory}"
    columns="#{bindingsAdminResultBeanresultBeanArray.attrHints.days.displayWidth}"
    binding="#{backing_Admin.inputText2}"
    id="inputText2"
    label="#{res['admin.daysheader']}"
    autoSubmit="true">
    <af:validateRegExp pattern="[0-9]+"
    noMatchMessageDetail="Please enter a number"/>
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.AdminResultBeanresultBeanArray.formats.days}"/>
    </af:inputText>
    java.lang.IllegalArgumentException: 'value' is not of type java.lang.String.
    at oracle.adf.view.faces.validator.ValidatorUtils.assertIsString(ValidatorUtils.java:36)
    at oracle.adf.view.faces.validator.RegExpValidator.validate(RegExpValidator.java:103)
    at oracle.adf.view.faces.component.UIXEditableValue.validateValue(UIXEditableValue.java:378)
    <af:validateRegExp pattern="[0-9]*"
    noMatchMessageDetail="Please enter Numbers only"/>
    Using validateRegExp i can only validate a field that accept String type data ..
    Thanks in advance.

  • Script to validate a field when submit button pressed not working

    I have a script to validate certain fields and generate an error message if fields are blank or not filled out correctly. Everything works fine except for one of them. I'm trying to generate an error message if one of the fields have an invalid format in it. For example, the format should be ''XXXX.XX'' (all numbers) so if they enter ''XXXX'' the error message will generate and the form will not submit. I have a function setup under this particular field and it works but unfortunately users are ignoring the error message and submitting the form anyway and this field really needs to be right before it's submitted.
    This is what I'm using for it:
    var bCancel = false;
    var strMsg = "";
    if (getField("Tracking").value == /^\d{0,4}(\.\d{0,2})?$/) {
    bCancel = false; }
    if (getField("Tracking").value != /^\d{0,4}(\.\d{0,2})?$/) {
    strMsg = "Invalid Format. Please correct before continuing. (EX: 0000.00)";
    bCancel = true; }
    So the problem is it generates the error message now even if the format is correct. I'm sure I did something wrong but I wrote the format the same way (/^\d{0,4}(\.\d{0,2})?$/) when I ran a custom format script under this field and it worked fine so I'm not sure what I'm doing wrong. I'm also including this part of the script with the rest of the field validations in the submit button. So altogether it looks something like this (just with a lot more fields, didn't include all of them bc it gets pretty redundant)
    var bCancel = false;
    var strMsg = "";
    if (getField("Tracking").value == /^\d{0,4}(\.\d{0,2})?$/) {
    bCancel = false; }
    if (getField("Employee Name").value >= 1) {
    bCancel = false; }
    if (getField("AcctNbr1").value >= 1) {
    bCancel = false; }
    if (getField("Tracking").value != /^\d{0,4}(\.\d{0,2})?$/) {
    strMsg = "Tracking field format is invalid. Please correct before continuing. (EX: 0000.00)";
    bCancel = true; }
    if (getField("Employee Name").value == "") {
    strMsg="At least one required field was empty on export. Please fill in the required fields (highlighted) before continuing.";
    bCancel = true; }
    if (getField("AcctNbr1").value == "") {
    strMsg="At least one required field was empty on export. Please fill in the required fields (highlighted) before continuing.";
    bCancel = true; }
    if (bCancel){
    app.alert(strMsg);
    } else {
    this.mailDoc({
    bUI:       true,
    cTo:      "[email protected]",
    cSubject: "Form Returned: Maintenance Form"});
    I'm fairly new to scripting, especially in Adobe, so I probably didn't do a great job with all of it. Please let me know if there's anything I need to change to get it working better. Thanks in advance for your help!

    OK, below are two regular expressions that may do what you want:
    var re1 = /^\d{4}\.\d{2}$/;
    var re2 = /^[1-9]\d{3}\.\d{2}$/;
    The first, re1, will match any four digits, followed by a decimal point, followed by two digits. A potential problem with this is it will match a string like "0001.23", which may not be what you want. If you don't want it to match a string with leading zeroes, you can use the second one, re2. It will match any digit from 1 to 9, followed by any three digits, followed by a decimal point, followed by two digits.
    The test method of a regular expression takes a string as an argument and will return true if it matches the regular expression, or false if it doesn't. Here are some example outputs given various field values and methods of getting the field values:
    // Text1 field value is 0123.45
    // Get the field value.
    // The variable num will be a number, not a string
    // num will equal 123.45
    var num = getField("Text1").value;
    // Test regular expression against num
    bOK = re1.test(num);   // returns false
    // Now get the field value as a string
    // num will equal "0123.45"
    var num = getField("Text1").valueAsString;
    bOK = re1.test(num);   // returns true
    // Now use the other regular expression
    bOK = re2.test(num);  // returns false
    // Text1 field value is now 1234.56
    // num will equal "1234.56"
    var num = getField("Text1").valueAsString;
    bOK = re2.test(num);   // returns true
    To summarize, if you want to not allow leading zeroes, get the field value using the valueAsString field property, and use a regular expression that does not match a leading zero. You should probably change the regular expression you're using in the Keystroke script if you want to prevent the user from entering a number with any leading zeroes.

Maybe you are looking for

  • How do I know if version 8.01 was successfully installed?

    I am having the CRASH problem while opening a project.  I downloaded and supposedly installed the update 8.01 but when the program opens it sitll says 8.0. And the CRASH still happens. Windows 7-64 8G RAM Thanks Much

  • Changing the default Zone AAM in SharePoint

    SharePoint Web App Provides 5 different Alternate access mapping Zone. What is the best practice, is it the good practice to change the Default Zone of Web app in AAM.  

  • Creating a new apple id for my wife

    I currently have one Apple ID and run iTunes on a Windows 7 PC. This is synced to 2 iPhones, 2 iPads and 2 iPods as well as 2 Apple TV's. All the Apps purchased, updated and shared between all the devices are controlled using iTunes depending on whos

  • Free goods determination in CRM

    Hi all, Got a question about free goods in CRM. In ECC, the free goods can be determined and there is no problem with it. In CRM, the customising was set up in the exact same manner (spro->CRM->Basic functions->free goods), create condition type, cre

  • How can I get my swf files playing on browser?

    Hello, I've been designing my first website and have used dreamweaver, which is very new to me. I've followed a very good beginners guide to making websites and all was well. However, it had nothing about uploading swf files. So I did some research,