Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Nested IF fields? (WinXP NL / Off2003 NL)

    In a document there are 2 dropdown formfields, DD1 containing 3 items and DD2 containing 4 or 5 items. Depending on the user's choices, next to each DD the appropriate text must be displayed. Example for DD1 (helptext 1/2 = max 50 chars):
    Item1 => "" (empty string)
    Item2 => "helptext 1"
    Item2 => "helptext 2"

    Is there a way to do this with (nested) IF fields, so there is no need to use VBA code? One of our users wants to use this in a series of documents. He has no knowledge of programming at all and wants to keep it that way...

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Nested IF fields? (WinXP NL / Off2003 NL)

    I nearly managed this by defining Document Properties containing each set of help text, and putting the property names in the dropdown list.

    I then used the field
    { DOCPROPERTY { REF HelpDropdown } }
    to display the help text, where HelpDropdown is the bookmark associated with the dropdown form field.

    The trouble with this is that even with Calculate on Exit set for the Dropdown form field, it needs an update fields to update the help text.

    StuartR

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Nested IF fields? (WinXP NL / Off2003 NL)

    Double click both dropdown lists (while the document is unprotected) and make sure that "Calculate on exit" is ticked.

    You can use nested fields like this:

    { IF { DDD1 } = "Item1" "" { IF { DD1 } = "Item2" "Helptext1" "Helptext2" } }

    { IF { DDD2 } = "Item1" "" { IF { DD2 } = "Item2" "Helptext1" { IF { DD2 } = "Item3" "Helptext2" { IF { DD2 } = "Item4" "Helptext3" "Helptext4" } } } }

    As always, the field brackets should not be typed, but inserted using Ctrl+F9. The nested field will be updated when the user presses Tab in the dropdown list, not when he/she selects an item.

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Nested IF fields? (WinXP NL / Off2003 NL)

    Thank you Hans, that is the only reason that my method wouldn't update the field.

    Here is an example, that may be easier to modify in the future than nested If fields.

    StuartR
    Attached Files Attached Files

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Nested IF fields? (WinXP NL / Off2003 NL)

    Your solution is much more elegant, and a lot easier to create and maintain. Nested fields are no joy to work with if the number of levels increases.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •