Make a field required based on input in another field

So I have researched the forum to answer the question of how to make certain fields in a form required if a value is entered in another designated field, and not required if no value is entered in the designated field.
For example:
There is a field titled QTY_paper, and if a value is entered into QTY_paper, then the field PROGRow1 should become required.
If no value is entered into QTY_paper, then PROGRow1 is not required.
I've tried both FormCalc and Javascript, but with no results. In FormCalc I added this script as a mouseExit event on QTY_paper:
if ($.isNull == 0) then
     //Make the budget field Required
     PROGRow1.validate.nullTest = "error";
endif
and then I added this script in FormCalc to the mouseExit event on PROGRow1:
if ($.isNull == 0) then
$.validate.nullTest = "disabled"
endif
This came almost verbatim from another post on the forum, so I'm thinking I'm missing something obvious here... which isn't too odd as I'm still pretty new at adding the scripts. Please help if you can!

You'd want to combine both scripts on the first field with an if/else statement. And I'd use the Exit event instead of Mouse Exit (not sure if Mouse Exit handles tabbing in and out of fields).
The first script should have worked, but with the second script you were asking if PROGRow1 was null, not QTY_paper.
FormCalc:
if ($.isNull) then
     PROGRow1.validate.nullTest = "error"
else
     PROGRow1.validate.nullTest = "disabled"
endif

Similar Messages

  • Field validation - make field required based on value of another field

    Hi,
    I tried to enter the field validation into both LeadSource and stSource_Detail field, however, when the LeadSource is not "Customer" or "Staff" and Source Detail is not empty, the validation message will prompt. Below is my field validation:
    IIf(([<LeadSource>]=LookupValue("OCCAM_LEAD_SOURCE", "Customer") OR [<LeadSource>]=LookupValue("OCCAM_LEAD_SOURCE", "Staff")) AND [<stSource_Detail_Staff_ID__Customer_ID_ITAG>] IS NULL,N,[<stSource_Detail_Staff_ID__Customer_ID_ITAG>])

    Field Validation statements must return only TRUE or FALSE. Rewrite your statement such that if your condition is valid, true is returned, and if not, false is returned.
    Thom

  • Activate input for a field depending on the input in another field

    Hy gurus,
    A have a report with select option.
    In the select option I'd like to have the following:
    I have a checkbox ,if it is flagged the input for another field should be made possible.
    The problem is,to activate it right after I flag the checkbox (without having to press ENTER)
    Do you have suggestions?
    Thanks,Christian

    Hi Christian
    It's the same, check my sample in the last my answer.
    If you want to protect a SELECT-OPTION or more than one parameter it should use the group.
    SELECT-OPTIONS: S1 FOR SY-DATUM MODIF ID AAA,
                    S2 FOR SY-UNAME MODIF ID BBB
    PARAMETERS: p1  MODIF ID AAA,
                p2  MODIF ID BBB.
    PARAMETERS: p_ck AS CHECKBOX USER-COMMAND aaa.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF p_ck = 'X'.
          IF screen-group1 = 'AAA'.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ELSE.
          IF screen-group1 = 'BBB'.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDIF.
      ENDLOOP.
    Max

  • Using Javascript to show/unshow a field based on input in another field

    I want to display/not display a field in a JSP depending on what is selected in another field.
    I am using <div></div> element currently which is displayed/not displayed using a Javascript invoked by the first field.
    the problem with div is that I have to put it inside a <tr><td> otherwise it doesn't work. This makes the field look aloof from the rest of the page, and is also not aligned with the other fields.
    Is there anything other than <div> that can be used? or is there a way to correct the look of the field inside a div?
    Thanks

    You shouldn't have to put it inside a <tr><td> to get it to work. I've done what you are trying to do with <span></span> and it worked fine. I haven't tried it with a <div> but I can't image why that wouldn't work. Maybe you could post your code.

  • Field Populates based on Selection in Another Field

    Hi everyone,
    I have created a new position description template using a pdf form. In this form I have various fields. I would like to populate one field based on what I have selected in another field. For example, I have a field called competency. In this field I can select and choose a competency. If I select "Accountability" I would like the description field to say " Accepts personal responsibility for the quality and timeliness of work. Can be relied upon to achieve results with little need for supervision. " alternatively if I select "Compliance" I would like the description field to say "Complies with policies, procedures, workflows and instructions." Can anyone assist me with script or is there another way of making this happen.
    Thanks in advance

    I think this is what you are looking for:
    Make sure that you select "Commit selected value immediately" in the options tab of the drop down menu.
    //Place this script in the custom validation script of the drop down menu
    //Create a text field caleld Text2
    var MySelection = event.value;
    switch (MySelection) {
    case "Accountability":
        this.getField("Text2").value = "Accepts personal responsibility for the quality and timeliness of work. Can be relied upon to achieve results with little need for supervision. ";   
    break;
      case "Compliance":
        this.getField("Text2").value = "Complies with policies, procedures, workflows and instructions.";
        break;
    I hope this helps.

  • Populate text in field 1 based on calculation in another field

    Hello,
    Currently, I have a calculated field that is the sum of 7 numeric fields. I then have a text field that I would like to populate based on the calculation.
    For example, if the value in the calculated field (Total) is "27", textfield should read "Great Job". If Total is >27, the textfield should read "Keep Trying".
    I have two questions... What script should I try? and Where should the script reside?
    I have tried to add script in the 'change' section of the Total field, but since the user is not changing this field (it is calculated), the script is not being triggered. I have tried the script in the 'change' section of each of the 7 numeric fields, but am having trouble referencing the Total field value.
    Any help would be appreciated.
    Thanks
    E

    Eric,
    I added 8 Numeric Fields named MonTotal, TueTotal, WedTotal, ThurTotal, FriTotal, SatTotal, SunTotal and WeekTotal.
    I added a FormCalc script to the calculate event of the WeekTotal Numeric Field shown below:
    form1.#subform[0].MonTotal + form1.#subform[0].TueTotal + form1.#subform[0].WedTotal + form1.#subform[0].ThuTotal
    + form1.#subform[0].FriTotal + form1.#subform[0].SatTotal + form1.#subform[0].SunTotal
    Once I saw the calculation was working I inserted a new text field named "Comment" and a standard button (Labeled "Click on Completion" and added a FormCalc script to the click event of the standard button shown below:
    if (form1.#subform[0].WeekTotal == 27) then
    form1.#subform[0].Comment = "Great Job!!!"
    elseif (form1.#subform[0].WeekTotal > 27) then
    form1.#subform[0].Comment = "Keep Trying!!!"
    endif
    Hopefully this is helpful.
    Have a great day!
    Pam

  • Form Personalization - Make field required based on LOV selection

    Newbie here.
    I am trying to make a field required based on the selection of the LOV that is next to it. Having a heck of a time with it.
    The form i am working on is the Sub Invenntory form that you get to via Organization Items. We want the subinvnetory field to be manditory when subinv is selected from the LOV in the sources tab.
    here is what i have so far:
    CONDITION
    Trigger Event: WHEN-VALIDATE-RECORD
    Trigger Obj: ITEM_SUBINVENTORIES
    Condition: ${item.item_subinventories.SOURCE_TYPE.value} = 3
    Action
    Type: Property
    Object Type: Item
    Target Object: ITEM_SUBINVENTORIES.SOURCE_SUBINVENTORY
    Property Name: REQUIRED
    Value: TRUE
    The problem seems to be that i can't get the field to be required. It shows up yellow but still allows me to save w/ the field being blank.

    I do not know about the particular form that you are trying to personalize, but whenever I have created a condition, it has usually been in the following syntax:
    :BLOCK_NAME.FIELD_NAME = 'VALUE'
    For example, :MTL_SYSTEM_ITEMS.PRIMARY_UNIT_OF_MEASURE_MIR = 'SEAT'
    Yours seems to be very much different from mine, but then again, I am not technical so I cannot comment intelligently on that aspect.
    May be that is the problem.
    Also, once you get it to work, you might want to also add a condition where the field is turned to un-required when the SOURCE_TYPE is NOT 3.

  • In BI how to filter the selection options based on inputs on top field

    Hi Friends,
    In BI, How to filter the selection options based on inputs on top field.
    The system should automatically filter the lower level drop downs based on the selection of a higher level.
    For e.g. :
    If a user selects a Country then the States drop down should only display the State's belongs to the Country. Similarly when a State is selected, the District drop down should display only those District's belongs to the State.
    Thanks in Advance.
    Regards
    Jayaram M

    Hi Anil,
    Thanks for reply but I couldn't use Compounding Characteristic here. Need some other solution.
    Regards
    Jayaram M

  • Field with a default value from another field

    I need to populate a field as the default value from another field that the user inputs. I've tried the scripting that I found from the below Topic in the Archived Forums, but I'm not able to make it work. I've tried numerous variations and still to no avail. I tried to make the scripting work in Acrobat 6 and then decided that maybe I needed to upgrade, so I'm now trying it in Acrobat 8 with no results. Can anyone help?
    Topic
    Acrobat 5 - field with default value of another field
    Ben PF - 03:31am Mar 23, 2007 Pacific
    How can I have a field date2 which has the default value of field date1, but which can be edited by the user if necessary without changing the value of date1.
    I've tried, but I just can't figure it out!
    Any help much appreciated.
    Ben
    | Back to Topic List | Bookmark | Subscribe
    To start a NEW discussion click on the Back to Topic List link and select Add Topic.
    If you are in an archive forum please go up to the main topic list (archives are read only).
    Messages
    2 messages. Displaying 1 through 2.
    First Previous Next Last Show All Messages
    Gene Dianoski - 5:22am Mar 23, 07 PST (#1 of 2)
    This, or some variation of this, should work:
    if(this.getField("date2").value == ""{
    this.getField("date2").value = this.getField("date1).value;
    | Bookmark back to top
    Ben PF - 6:49am Mar 23, 07 PST (#2 of 2)
    Thanks very much.
    I put it in at document level to start, but it didn't run the script automatically when date1 was first filled in, so I have put it in as a mouse exit action in date1 and it works a treat.
    Thanks for your help.
    Ben

    Okay forget what I posted above and lets start over. Go to your first field and under Properties -> Actions Tab -> Select Trigger -> On Blur Run A JavaScript.
    Put this:
    this.getField("myField2").value = event.target.value;
    Make sure that you replace ("myField2") with the actual name of your second field. I just tested this and it works for Acrobat version 6.
    I haven't been doing as much javascripting as I used to, so sometimes I too make some basic mistakes.

  • Making fields required based on other field input

    I am creating a form in adobe acrobat pro that employees need to fill in to show the clients they have worked for in a week. The form has 10 lines for them to fill in the date, client name, address etc for 10 clients. I want to make the client name and address fields required only if the date has been filled in in the first column. I can't make every row required fields as they may not have 10 clients that they have worked for. I have a send button set up so that all required fields are completed before the form can be sent. Can someone help me with the script I would need. I have worked out how to make the fields required if a check box is ticked but can't find any scripting for fields to be required if text has been entered in a specific field.

    You can use the custom validation script of the date fields. Let's say you
    want to make Name1 and Address1 required if Date1 is not empty.
    Use this code to do it:
    this.getField("Name1").required = event.value!="";
    this.getField("Address1").required = event.value!="";

  • Fields required based on a value in another field

    Hi,
    I am looking to have fields required (Annual Revenues and # of Employees) based on the value of another field (Ownership). Basically, if the value is Public the user is required to enter the Annual Revenue and Employees fields. I thought about using dynamic layouts but the only key field for Accounts is Account Type.
    Thanks,
    Caryn

    Hi Caryn!
    I think it is not possible for making #Employees and Revenues required depending on Ownership(as it is a look up field).. it should be possible if you want to do it on any other criteria other than ownership by just renaming the Account Type, Disable all the values of Account Tyope add new values to Pick List and make it driving picklist upon your requirements..
    If you require Account Type, create a custom picklist "Account-Type" and add the values.

  • Grouped output required based on input group :No one???????

    Hi to all,
    I want grouped output based on input group.
    e.g
    SQL> select * from test_data;
    FIELD
    a
    b
    c
    d
    e
    a
    e
    c
    d
    e
    10 rows selected.
    SQL>
    Now I want grouped output like this
    When I give input set (a,b) then output should be :
    a,b
    a
    c
    c
    d
    d
    e
    e
    e
    When I give input set (a,e) then output should be :
    a,e
    a,e
    b
    c
    c
    d
    d
    e
    I want a query regarding this , I know this is possible through Pl/SQL, but the requirement is through query.....
    rgds,
    Rup

    I want grouped output based on input group.
    I want a query regarding this
    with
    test_data as
    ( select substr(p, instr(p, ',', 1, level) + 1, instr(p, ',', 2, level) - instr(p, ',', 1, level) - 1) as field
        from (select ',' || 'a,b,c,d,e,a,e,c,d,e' || ',' as p from dual)
        connect by level <= length(p) - length(replace(p, ',')) - 1
    input_set as
    ( select distinct substr(p, instr(p, ',', 1, level) + 1, instr(p, ',', 2, level) - instr(p, ',', 1, level) - 1) as field
        from (select ',' || 'a,d,e' || ',' as p from dual)
        connect by level <= length(p) - length(replace(p, ',')) - 1
    group_count as
    ( select min(count(i.field)) as group_cnt
        from test_data t, input_set i
        where i.field(+) = t.field
        group by t.field
        having count(i.field) > 0
    test_data2 as
    ( select field,
          row_number() over (partition by field order by null) as group_no1,
          row_number() over (                   order by null) as group_no2
        from test_data
    input_set2 as
    ( select field, row_number() over (order by field) as item_no
        from input_set
    select max(fields) as fields
      from
      ( select
            replace(sys_connect_by_path(decode(level, 1, group_no2), '-'), '-') as group_no,
            ltrim(sys_connect_by_path(t.field, ','), ',') as fields,
            level as lvl
          from test_data2 t, input_set2 i, group_count
          where i.field(+) = t.field
          start with group_no1 > group_cnt or item_no = 1 or item_no is null
          connect by prior group_no1 <= group_cnt and group_no1 = prior group_no1 and item_no = prior item_no + 1
      group by group_no
      order by max(lvl) desc, fields
    FIELDS
    a,d,e
    a,d,e
    b
    c
    c
    e
    6 rows selected.

  • Numeric format based on data in another field

    I am trying to set up a form where the numeric format of one field is based on units of measure in another field. The fields are: units1 and iq1. What I want to do is have the iq1 field format for percent with two decimal places when units1 is  LS or ls or L.S. or l.s. otherwise the field should be formatted for a number with the format nnn,nnn,nnn.nn. Any help for this newbie is appreciated.

    I think this is what you are looking for:
    Make sure that you select "Commit selected value immediately" in the options tab of the drop down menu.
    //Place this script in the custom validation script of the drop down menu
    //Create a text field caleld Text2
    var MySelection = event.value;
    switch (MySelection) {
    case "Accountability":
        this.getField("Text2").value = "Accepts personal responsibility for the quality and timeliness of work. Can be relied upon to achieve results with little need for supervision. ";   
    break;
      case "Compliance":
        this.getField("Text2").value = "Complies with policies, procedures, workflows and instructions.";
        break;
    I hope this helps.

  • Show / hide field based on text in another field

    Hi,
    I'm trying to make one of my fields reactive to what is the text generated in another field.
    At the moment I have this under calculate using custom javascript:
    var Mask = this.getField("Course").value;
    if(Mask == 'Swimming') this.getField("Code").display = display.visible;
    else this.getField("Code").display = display.hidden;
    Whereas Course is the field that is changing and Code is the one that will show/hide based on content of Course.
    Any help?

    Hi Everyone,
    After doing trials with simple calculations it still wasn't working and so I've figured out what the problem is - the document was being exported but with the data being pre-populated from an SQL database in which during the export it all happens at once, not a chain effect so when the export happens it was filling "Code" before "Course" had any info in it...
    The fix was basically having to create a different field in the SQL source itself for an independent field on the pdf form.

  • Problem in popultating combobox based on input from another combobox

    i have there combo boxes when i select the first combobox ,based on the input given it must populate the second and based on the input in second combo box it must populate the third one.1->2->3.
    Actually i am having a javascript when i select the data in first combo box the information is sent to specified jsp page with parameter using onchange function and the second combo box is poplated based on the first but the third combo box in not populating based on the second.
    here is my code:
    jsp:
    <select name="recrClient" class="selectBox" id="recrClient" onchange="htmlData('BSTSRecuritmentContacts.jsp', 'client='+this.value);">
    javascript
    function stateChanged()
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    document.getElementById("contacts").innerHTML= xmlHttp.responseText;
    else
    //alert(xmlHttp.status);
    // Will populate data based on input
    function htmlData(url, qStr)
    if (url.length==0)
    document.getElementById("contacts").innerHTML="";
    return;
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    alert ("Browser does not support HTTP Request");
    return;
    if (url=="BSTSRecuritmentContacts.jsp")
    url=url+"?"+qStr;
    url=url+"&sid="+Math.random();
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true) ;
    xmlHttp.send(null);
    if i use the same method populating the third combo box, this is not working
    please reply me and thanks in advance

    Hi there,
    What about this:
    Create a multicube with 0PA_C01 and 0PE_C01 and then you create one key figure with the total of employes (that comes from 0PA_C01) and another key figure with the total number of employes that had training (that comes from 0PE_C01) and finally you create a calculated key figure at query level that subtracts the first key figure by the second, i.e., the total number of employees - the employees that had training.
    Diogo.

Maybe you are looking for