Various Selections in Combo Box trigger required field

Can anyone assist me in creating a multiple if/else statement? I have a combo box which lists all departments within my organization. I am needing assistance in creating an if/else statement that basically says if the department name is equal to say Finance, Accounting, Purchasing, etc. that a signature field is hidden because it is not required. However, if the department name were Information Services, Library, etc. the signature field would be required.
I can get this to work if I use just one value (i.e. Finance), but when I add other values (and I've tried different methods) nothing happens.
Thank you for any assistance you may provide.

Check your JavaScript debugger console for errors.
var s1 = this.getField("RBDeptHdYes").valueAsString;
var s2 = this.getField("State").valueAsString;
var s3 = this.getField(CMSignature); // field name must be in quotes
if ( s1 == "Yes")
s3.required=true;
if (s2 != "Texas"); // no ";" here
s3.required=true;
if (s1== "Yes" && s2 == "Texas")
s3.required=true;
else
s3.hidden=false;
I might be easier to crate a control variable that can be set to true or false by each test and then test the control variable at the end.
var bRequired = false; // assume not required
this.getField("CMSignature").hidden = true; // hide field
var s1 = this.getField("RBDeptHdYes").value;
var s2 = this.getField("State").value;
if ( s1 == "Yes") bRequired = true; // required
if (s2 != "Texas") bRequired = true;
if (s1== "Yes" & s2 == "Texas") bRequired = true;
if (bRequired) this.getField("CMSignature").hidden = false; // signature is required
Your script has to be placed in the "mouse up" for the radio buttons and the "blur" action for the state combo box so that when any one of these fields is changed, the script will run. This means that whenever your requirements change, each location will have to be updated unless you use a document level function which is called by each field as needed and then only the function's code would need to be changed.

Similar Messages

  • Calling a bean method on select of Combo box item

    Hi
    On select of Combo box item in a form, text fields in the same form should be populated
    dynamically.Is it possible to call a bean method which does this,by calling onSelect() method
    of combo box ?
    Thanks in advance,
    Sridevi

    Uff, sorry!
    I ment that you write some code for the "onSelect" event which sends a request to the server with the selected value: onSelect="self.location.href='<%= request.getRequestURI()%>?selectedVal= ' + this.selectedIndex;"

  • How to show default value selected in combo box...

    Hi,
    I need an help...
    I have a combo box and i want to show the default value(coming from DB) selected on combo box on Page Render.
    Thanks,
    Neha

    Hi,
    Will this help?
    database default value in selectOneChoice
    Set default selected value in a SelectOneChoice
    Regards
    Vishal

  • Can I Display a Selection or Combo box using MIDP

    Hey All,
    How can I display a Selection or Combo box in My Form Using MIDlet. Please send a Way to do this. Thanks in Advance.

    Hi
    use 'List' for displaying menu..
    check the api for 'javax.microedition.lcdui.List' class
    regards
    williams

  • Default selection in combo box at struts form

    hi friends..i am new person in struts form..this is my prg.. display combo box value in 18. but i want 20...how to write program....plz anybody help me....thank you............
    <%
    for (int index = 18; index < 56; index++)                                                                           %>
    <html:option value="<%=index + ""%>">
    <%=index + ""%>
    </html:option>
    <% } %>

    what you need is field "value" in the select:
    [http://struts.apache.org/1.2.x/userGuide/struts-html.html#select]
    see "value" property
    (found it easily with "struts option selected" on google)

  • Multiple selection in combo box

    Hi,
    How to save the selected values (with multiple selection) in to the database from combo box. I made it as multiple selection box by selecting value true for attribute Multiple, but only one value is saving in to database. How to handle it.
    Regds,
    Sudhakar

    I 'll explain the requirement:
    I have three tables, for example employee, department and empDept table which contains empId and DeptId. In my jsp, while inserting employee i need to give all existing departments in combo with multiselect option. When user press submit, i need to insert one record in employee, and records in empDept with new empId and all selected Department ids. empId is dbsequence generation.
    (I did this through LOV mode of list binding editor. Even i select multiple values in JSP, its inserting only first selected record in to empDept table.)

  • Can't select a combo box?

    I'm fairly new to Flash and am having a little problem.
    Basically I have a the top of a clipboard visible at the
    bottom of the screen. When it is rolled over the clipboard rises up
    from the bottom until it is completely visible on the stage. I did
    this by creating a movieclip containing the picture of a clipboard
    and tweening it to come up, and then reversing it to go back down.
    I placed stop actions at the beginning of the movieclip, the fully
    visible position, and a gotoAndStop command at the end of the
    movieclip to return it to the start. I placed the movieclip on the
    stage, and used onRollOver and onRollout events to trigger the
    tweens.
    To ensure that the bottom of the clipboard isn't visible when
    the clipboard is off screen, I added a mask over the stage area so
    that only the portion of the clipboard on the stage will ever be
    visible.
    Here comes the question: Now I need for the clipboard to
    display a few questions with combo boxes that the user can select
    and choose an answer from when the clipboard is in it's fully
    visible position. I can get the questions onto the clipboard by
    placing them in their own layer within the movieclip. However, I
    can't make the combo boxes selectable. Is this a focus problem? Do
    I just have the questions layer in the wrong place? Does any of
    this even make sense? Any help would be greatly appreciated.

    I'm fairly new to Flash and am having a little problem.
    Basically I have a the top of a clipboard visible at the
    bottom of the screen. When it is rolled over the clipboard rises up
    from the bottom until it is completely visible on the stage. I did
    this by creating a movieclip containing the picture of a clipboard
    and tweening it to come up, and then reversing it to go back down.
    I placed stop actions at the beginning of the movieclip, the fully
    visible position, and a gotoAndStop command at the end of the
    movieclip to return it to the start. I placed the movieclip on the
    stage, and used onRollOver and onRollout events to trigger the
    tweens.
    To ensure that the bottom of the clipboard isn't visible when
    the clipboard is off screen, I added a mask over the stage area so
    that only the portion of the clipboard on the stage will ever be
    visible.
    Here comes the question: Now I need for the clipboard to
    display a few questions with combo boxes that the user can select
    and choose an answer from when the clipboard is in it's fully
    visible position. I can get the questions onto the clipboard by
    placing them in their own layer within the movieclip. However, I
    can't make the combo boxes selectable. Is this a focus problem? Do
    I just have the questions layer in the wrong place? Does any of
    this even make sense? Any help would be greatly appreciated.

  • Default Selection in Combo Box

    Hi,
    I have a query regarding combo box. I have populated combo box using UserDataSources. Is it possible to make a default selection of an Item in combo box.
    Regards
    Ronald

    Hi Ronald,
                   I  hope the following code helps
                           Dim oComboVal1 As SAPbouiCOM.ComboBox
                           Dim oCol As SAPbouiCOM.Column
                           oCol = oMatrix.Columns.Item("V_12")
                            oComboVal1 = oCol.Cells.Item(Row).Specific
                            oComboVal1.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)
                            here
    Regards
    V.Rangarajan

  • How to populate a list box linked to selection in combo box?

    Hi All,
    I am a beginner in Xcelsius. I am having problem on how to populate a list box based on the selection on my combo box.
    I have a combo box and a list box.  The combo box value consist of Countries. Values are:
    Singapore
    Indonesia
    Thailand
    When I select, for i.e. Indonesia, I want to populate the list box with all the Postal Code of Indonesia. When I select Thailand, i want to do the same.
    Can anyone shed some lights on how to achieve this?
    My spreadsheet data is as follow
    Country         Postal Code
    Singapore     680123
    Singapore     680124
    Singapore     680125
    Indonesia     155123
    Indonesia     155124
    Indonesia     155125
    Indonesia     155126
    Thailand       333123
    Many Thanks,
    Harianto

    Hi,
    I am detailing the complete steps below:
    In the combobox select the entire range of Country while seeing the records from the Combobox, Xcelsius will automatically show the unique values in the selection.
    After that in the "Data Insertion" section for Combobox select the "Insertion Type" as "Filtered Rows" (please click on the question mark beside this option and it will show how the selection works).
    In the source select the postal code, in the destination select the range which will be used as a data source for the list box.
    This will resolve the concern. Please remember to select the question mark beside the "Insertion Type" option, it explains the working in specific details.
    Best of luck.
    Regards,
    Gourav

  • How to enable group label selectable on combo box?

    When we use the combo box, we can group the items as following
    group 1
    item 1 1
    item 1 2
    group 2
    item 2 1
    item 2 2
    How to enable user select the group 1 instead of select both item 1 1 & item 1 2 ?
    In the jsf rendered result, group 1 & group 2 just a label and not selectable option, we want change it to selectable option.
    Thanks

    When we use the combo box, we can group the items as following
    group 1
    item 1 1
    item 1 2
    group 2
    item 2 1
    item 2 2
    How to enable user select the group 1 instead of select both item 1 1 & item 1 2 ?
    In the jsf rendered result, group 1 & group 2 just a label and not selectable option, we want change it to selectable option.
    Thanks

  • Testing for no selection of combo box - mandatory combo

    What si the best way to see if a combo box has not been selected when it does not have a default value?
    if (ocombo.Selected.Value="")

    Hi,
    some solutions
    in c#
    if (((SAPbouiCOM.ComboBox)(oForm.Items.Item("cmbUID").Specific)).Selected != null) {
    in vb6
    if (NOT(oForm.Items.Item("cmbUID").Specific.Selected is nothing)) then
    you can also try
    if( oCombobox.Selected is null)
    lg David

  • Conditional Formula between Check Box, Combo Box and Text Field

    I am very new in this area and just trying to figure out things here. Anyway, what I am trying to do is quite straight forward. I have a TextField, which the content is depending on what being selected in the CheckBox and ComboBox. The TextField shall give the value of the membership fee depending either he is Local or Abroad (CheckBox) and depending on Age Categories (ComboBox). Could you please help me in getting the script? Really appreciate it and thanks a lot in advance.

    hi gilad,
    tried your code already and and changed accordingly to mine:
    event.value = "";
    var type = this.getField("NatKid1").value;
    var age = this.getField("AgeKid1").value;
    if (type=="Yes") {
        if (age=="1")
    event.value = 0;
        else if (age=="2")
    event.value = 1;
        else if (age=="3")
    event.value = 3;
    } else if (type=="No") {
        if (age=="1")
    event.value = 0;
        else if (age=="2")
    event.value = 1.5;
        else if (age=="3")
    event.value = 4;
    and it works!!! still doing some trial run on some devices/gadgets and shall let you know. thanks again, gilad

  • Making Check box a required field

    Hi Guys,
    I am currently creating a form to put on my website and it is
    working okay. However, I want a check box for people to tick
    confirming they have read the terms and conditions.
    I cannot work out how to make it so the form will not send
    without the box bring ticked.
    If i could get it set up so that when trying to submit the
    form without having the box ticked it would leave a message
    explaining the box needs to be ticked that would be good to!
    Can anyone help me please? Am at my wits end!!!

    On 19 Mar 2007 in macromedia.dreamweaver, jameshuk wrote:
    > I am currently creating a form to put on my website and
    it is
    > working okay. However, I want a check box for people to
    tick
    > confirming they have read the terms and conditions.
    >
    > I cannot work out how to make it so the form will not
    send without
    > the box bring ticked.
    >
    > If i could get it set up so that when trying to submit
    the form
    > without having the box ticked it would leave a message
    explaining
    > the box needs to be ticked that would be good to!
    The only way to do that client-side is with Javascript (which
    is not a
    bad measure for cutting down on spambots), but it's not
    reliable. The
    only way to do it reliably is serverside. PHP:
    <?php
    if ($_POST['checkbox'] == 'checked') {
    // Process form
    } else {
    // Send back to check checkbox
    ?>
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/email.php

  • Access 2010 - How to display data from a table into a text box upon combo box selection?

    Hi
    I have a a table with 5 columns: month, year, USD, SGD, BAHT.
    I created a form with a combo box for selection of the month and year, and I would like to set adjacent text boxes to show USD, SGD, BAHT information. How can i go about doing that?
    From the Q&A here, most of them uses the function similar to this "=[Combo0].[Column](1)" to show the data in the text box, but this would require the combo box to list a whole bunch of details if i were to add in more currency values to the
    table. Is it possible to not show this information in the combo box, but still populate data in the textboxes base on a selection on only the "month" and "year" in the combo box.

    Hi,
    According to your description, my understanding is that you want to show only the month/year in the combo box, we can choose the date, and it will display the value of USD/SGD/BAHT based on the month/year.
    If it is, I recommend you try the steps:
    Create a form based on your data source table>Add the combo box>combo box wizard>Find a record on my form based on the value I selected my combo box>Add mouth and year to selected fields
    http://office.microsoft.com/en-us/access-help/create-a-list-of-choices-by-using-a-list-box-or-combo-box-HA010113052.aspx
    If I misunderstand something, please let me know. We may upload some screenshots or a sample through OneDrive.
    Regards,
    George Zhao
    TechNet Community Support

  • Report error when using combo box and one text field is empty

    I'm building an interactive pdf in adobe pro 9. My problem is the following: I have one text field where you can enter a numeric code and that is used to populate another text field when I choose an option on one combo box.For example: suppose I write the code 123 in the text field "A" and that the combo box has two options ("data" and "-"). When I select "-", another text field "B" is empty, while when I select "data" i populate the text field "B" using the code entered "A" with the text "data_123". In order to do this I use the standard javascript code in the Format>Custom tab of the combo-box.
    My questions are:
    - how can I prevent the pdf to proceed selecting an option in the combo box when the field "A" is empty?
    - how can I update the field "B" every time that I change the text in "A"? I found that the text is "B" is updated only when I press the selection in the combo box.

    You can set the combo box to read-only in the Validate event of the A field:
    // Validate script for text field
    getField("combo1").readonly = !event.value;
    To update the value of B when A changes, you can expand the script above to something like:
    // Validate script for text field
    var f1 = getField("combo1");
    var f2 = getField("B");
    // If there is an entry in the A field...
    if (event.value) {
        f1.readonly = false;  // Make sure the combo box is activated
        f2.value = f1.value === "-" ? "" : "fa.value + event.value;  // Update the value of field B
    } else {
        f1.readonly = true;  // Deactivate the combo box
        f2.value = f2.defaultValue;  // Reset field B
    You might also want to reset the combo box somewhere in there, but it's not clear to me when you would want to do that.

Maybe you are looking for

  • Display resolution conflict

    I tried to increase the resolution of my display beyond the limits of the monitor. How do I change back to a compatible resolution when the monitor won't show an image. Is there some key I can press during bootup to force some sort of safe mode?

  • What is the best way to run windows on my Mac? And What are the pitfalls I should watch for?

    What is the best way to run windows on my Mac?   What are the pitfalls/

  • How do I STOP iOS6 emailing my notes to myself?

    How do I STOP iOS6 emailing my notes to myself?

  • 'Resampling' images

    I'm using Photoshop Starter Edition 3.0 on Windows XP and I want to resize images (or 'resample') so that the image takes up less bandwidth when I upload it to a website. But I can't find any drop-down menus or links in the programme to resize. How d

  • *** .html formatting looks funny

    I'm trying to do a 1-page flyer for a sale for my company and export it as .html in order to do an email blast. I'm finding that when I export, upload it to my site and then look at it, the formatting is all off. In Safari the background images and t