How do I get a field to automatically select a value and change color based on another automatic field?

Here is the situation:
I have a row on a form called Finding Risk Rating. In this row are four fields: Probability, Severity, Risk Rating, Color.
Probability is a drop down menu with the following values: 1, 2, 3, 4, 5
Severity is a drop down menu with the following values: A, B, C, D, E
Risk Rating is a field that I have a custom calculation script:
var riskRating = this.getField("Probability").value+this.getField("Severity").value;
event.value = riskRating;
So, when I pick Probability = 1 and Severity = D, Risk Rating will automatically change to 1D, etc. This works fine on the surface as far as I can tell.
The part where I am stuck, is the fourth field Color.
Ideally, I want Color to be automatically populated depending on the value of Risk Rating. For example, for 1E I would want it to say "YELLOW" and the field to change color to yellow. For 1A it would be "GREEN" with the color green, etc.
I tried doing an if else for all cases, but it never refreshes to the correct value. I then checked using app.alert to see what fields riskRating and colorRank are (see code below), and I noticed that riskRating never changes, even though the value in Risk Rating changes. Is there a way to order script(s) so that if I execute one, the other will follow? I'm new to scripting for forms and haven't done any programming in 10+ years, so feel free to rip my code in favor or something more efficient, or direct me to a good resource I can learn from.
Here's the basis of what I have for scripting on Color. It's brief because I wanted to test it out before writing every 'if else' statement.
var colorRank;
var riskRating = this.getField("Risk Rating").value;
if (riskRating = "1E") colorRank = "YELLOW";
else if (riskRating = "1A") colorRank = "GREEN";
else if (riskRating = "5A") colorRank = "RED";
event.value = colorRank;
app.alert("colorRank = " + colorRank + ", riskRating = " + riskRating);
Any help is appreciated. Thanks!

One problem is if more than one combo box item has the same number associated with it, you cannot simply set the export value to the corresponding number since they need to be unique (or the user interface behaves weird). One thing you can do is set up an object to associate a list item with a value, and look up the value in code when a list item is selected.
For more information, see: http://acrobatusers.com/tutorials/2007/js_list_combo_livecycle

Similar Messages

  • I have to select a file – get Info – and change – open with and change from preview to another program and CHANGE ALL everytime I boot up

    Why do I have to select a file – get Info – select – open with – and change from Preview to another program and click CHANGE ALL with every file extention everytime I boot up.

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -Rh $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    The first step should give you usable permissions in your home folder. This step will restore special attributes set by OS X on some user folders to protect them from unintended deletion or renaming. You can skip this step if you don't consider that protection to be necessary.
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    resetpassword
    That's one word, all lower case, with no spaces. Then press return. A Reset Password window will open. You’re not  going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • How can I get a drop-down list selection also be selected in another field with the same list but a different name?

    I have a street address and a billing address. A question is posed with a checkbox — "Is the billing address the same as the street address?" If Yes is checked, the street address automatically fills the billing fields. If No is checked, the user must fill in new information. In both the street address and billing addres, the State field is a drop-down list. How can I get the drop-down list selection in the street address State also be selected in drop-down list for the billing address State?

    Has anyone done this?

  • How do I get my calendar to sync on iCloud?  I changed a calendar event on my iPhone 4 and it has not changed in Entourage on my MacBook.  This is supposed to be automatic, isn't it?

    How do I get my calendar to sync on iCloud?  I changed a calendar event on my iPhone 4 and it has not changed in Entourage on my MacBook.  This is supposed to be automatic, isn't it?

    Entourage will not sync with iCloud, not now, probably not ever, time to change.

  • TS1398 How do I get my iPad to remember my home network? I already switched on the "automatically join known networks"

    How do I get my iPad to remember my home network? I already switched on the "automatically join known networks"

    turn off all of the ipads, (not put them to sleep but turn them off) then unplug your Wi-Fi router for 2 mins. Plug it back in and when all the lights are (green or blue, depends on who makes the router) turn on one ipad and then connect it, wait 3 mins and turn on the other and connect it, do this for each iPad and it should fix the problem.

  • How can I get a detail block to requery after a database change?

    Hi, I have a master/detail form. When the status of the master record changes, I need to update a date in one of the detail records. If I use SQL to update the detail row in the database in the ON-CHANGE trigger of the master block, how can I get the detail block to requery to show the change? When I try doing a go_block from any of the ...UPDATE triggers, it says it is restricted.

    wjpenfold,
    Do you have a "Relationship" defined between your Master and Detail blocks? If so, you simply need to requery your master block and the detail block will automatically be requeried. If you can't use a relationship, then you can use can create a timer in the trigger that updates the database and then in the When-Timer-Expired (WTE) trigger you can go to the detail block and execute a query. For example:
    /* Sample On-Change trigger */
    DECLARE
       timer_id  TIMER;
    BEGIN
    ....your code here that performs the update....
       /* Now create an instance of a timer */
       timer_id := Create_Timer ('upd_detail',1,NO_REPEAT);
    END;
    /* Sample Form Level When-Timer-Expired trigger */
    DECLARE
       timer_id   TIMER;
    BEGIN
       -- Find the timer first
       timer_id := FIND_TIMER('upd_detail');
       IF NOT ID_NULL(timer_id) THEN
          GO_BLOCK('DETAIL_BLOCK');
          Execute_Query;
       END IF;
    END;Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • How I can get the Billing Type for the sales order and its items

    How I can get the Billing Type for the sales order and its items. I mean from which SAP tables and how?

    Hi,
    You need to use two tables.
    First use VBFA. Enter the sales order number in the field Predecessar and the value M in SubCt field. This will give all the billing document number for the sales order items.
    Then use the billing document numbers in table VBRK, where in you can get the billing document type.
    Regards,

  • I just noticed that some of the movies I had in iTunes did not get transferred to the iPhone. The missing movies are shown as generic movie icons in the iTunes panel. How do I get the original movies to show up again and transfer to the iPhone?

    I just noticed that some of the movies I had in iTunes did not get transferred to the iPhone 5. The missing movies are shown as generic movie icons in the iTunes panel and are checked to select them. But they do not show up in iPhone Videos. How do I get the original movies to show up again and transfer to the iPhone? I recently upgraded Mac OS to 10.6.8

    1. iTunes won't offer cloud downloads for songs that it "thinks" are in your library, even if it "knows" the files are missing. If you've exhaustively searched for the missing files and there is no prospect of repair by restoring to them to their original locations, or connecting to new ones, then delete that tracks that display both the missing exclamation mark and are of media kind Purchased/Protected AAC audio file. Don't hide from iTunes in the cloud when asked, close iTunes, then reopen. You can download from the cloud links or iTunes Store > Quicklinks > Purchased > Music > Not on this computer > All songs > Download all.
    2. Why? Not sure, perhaps 3rd party tools or accidental key presses combined with previously hidden warning messages when trying to organize the library. There is a hint that using the feature to downsample media as it is synced to a device may also be involved, though I've not replicated it. Whatever the reason a backup would protect your media.
    tt2

  • How do I get more than one signature option in Fill and sign?

    How do I get more than one signature option in Fill and sign?

    Hi,
    Are you trying to place more than one signature on a PDF document?
    Please explain the workflow.
    Regards,
    Anand

  • I am trying to use powerpoint but when I open a document I want to work on it does not open on my desktop. It appears as open on mission control but it disappears offscreen. How can I get it to open where i need it and can work on it?

    I am trying to use powerpoint but when I open a document I want to work on it does not open on my desktop. It appears as open on mission control but it disappears offscreen. How can I get it to open where i need it and can work on it?

    It's almost certainly too late.
    The time to create a backup is before a catastrophe.  After a catastrophe, it's too late.

  • How can I get apple to email me things like updates and stuff like that on email?

    How can I get apple to email me things like updates and stuff like that on email?

    You can't.

  • How can I get iCloud to accept my working Apple ID and password

    My Apple ID and password works for iTunes and App Store.  I'm trying to set up iCloud on my iPhone and iPad but i keep getting an error message that reads unsupported ID.  Apple ID must be in the form of email address (@me.com).  I don't have a MobileMe account. How can I get iCloud to accept my working Apple ID and password?

    I've also reset my password to my Apple ID. I still get the Unsupported ID and password.

  • How do I get an iPad micro sim card for Austria and Italy?  We purchased one for Germany, but it doesn't cover in Austria or Italy

    How do I get an iPad micro sim card for Austria and Italy?  We purchased one for Germany, but it doesn't cover in Austria or Italy

    Compare the roaming charges from the German carrier with services like those:
    http://www.abroadband.com
    http://www.maxroam.com/Shop/Product/Detail.aspx?ProductId=787&cur=EUR
    Otherwise buy a pre-paid micro-SIM card for the iPad in each country you visit.

  • I purchased an app and it downloaded to my MacMini, how do I get it to show up on my iPhone and iPad?

    I purchased an app and it downloaded to my MacMini, how do I get it to show up on my iPhone and iPad?

    Sync it to the devices:
    http://support.apple.com/kb/PH12111
    Or you can download the app directly from your iPhone and iPad:
    http://support.apple.com/kb/ht2519
    Regards.

  • When my 6 year old daughter plays the free games that I have downloaded for her IPAD and IPOD, I am now getting upgrade charges on these free games to my AMEX Card. WHy is this happening and how do I get my AMEX card off of the IPAD and IPOD?

    When my 6 year old daughter plays the free games that I have downloaded for her IPAD and IPOD, I am now getting upgrade charges on these free games to my AMEX Card. Why is this happening and how do I get my AMEX card off of the IPAD and IPOD?

    She is making in app purchases. Probably not knowing what that means to your monthly credit card bill. Use the Settings app to enable restrictions and turn on restrictions for iTunes, App Store and in app purchases, mabe some others too. The restrictions will be set with a passcode to prevent your daughter from changing them.
    Settings > General > Restrictions

Maybe you are looking for