javascript help needed: Trapping "null" from pop up menu so it doesn't display

Ask a Question related to Adobe Acrobat Windows, Design and Development.

  1. #1

    Default javascript help needed: Trapping "null" from pop up menu so it doesn't display

    I am making some interactive forms which use the app.popUpMenuEx routene to make a pop up menu.

    When the menu is clicked on incorrectly ... the word Null is returned and is visable on the form field.

    I would like to "trap" this so it is not visable, leaving the form blank so someone could tab into the field and type an alternative if it isn't present on the pop up menu.

    Could someone help me with this ... here is what I have

    var x = this.getField ("med") //define field variable x
    cChoice = app.popUpMenuEx
    (
    {cName:"Flovent 44 MDI"},
    {cName:"Flovent 110 MDI"},
    {cName:"Flovent 220 MDI"}
    )

    med.value = ""+ cChoice +""

    OK ... now I tried to trap the null so it wouldn't display by trying this ... but I'm doing something wrong. (javascript newbie)

    if (""+ cChoice +"" == null)
    then (med.value = " ")
    else (med.value = ""+ cChoice +"")

    but that doesn't work ...
    Can anyone skilled at javascript help me so that the word null doesn't display if the pop up menu is exited incorrectly

    Thanks ...

    Steve Egge MD
    Steve_Egge@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. "Page" and "Rect" props of the Field prop in Javascript API
      Page property of the Field property in Javascript Acrobat API returns an array of pages that this field exists in. On the other hand, "rect" property...
    2. cfqueryparam ignores null="yes" when list="yes"
      I get an unexpected result when using cfqueryparam with list="yes" and null="yes" using CF 7.0.1 and MSSQL 2000. When i run this code: <cfset...
    3. "save", "selective color" menu go too slow. Please help!
      have intel pentium 4 cpu and photoshop 7. when im using "selective color" or "save" menu (im a novice of photoshop), i have to wait kind of long...
    4. "Start" "Program" "Menu" list is empty
      For what ever reason my list of installed programs in my "Start" "Programs" menu is empty. Anyone know how to restore the list. Thanks for your...
    5. Attaching "OnClick" Javascript code to dhtml popup menu links
      I am currently developing a web site using fireworks, and am trying to figure out a way (through hand-coding) of attaching a javascript function...
  3. #2

    Default Re: javascript help needed: Trapping "null" from pop up menu so it doesn't display



    var x = this.getField ("med") //define field variable x cChoice = app.popUpMenuEx
    ( {cName:"Flovent 44 MDI"}, {cName:"Flovent 110 MDI"}, {cName:"Flovent
    220 MDI"}






    That should be: var cChoice = app.popUpMenuEx...

    med.value = ""+ cChoice +""




    You don't want to do that yet, and no need to add the empty strings.

    if (""+ cChoice +"" == null)




    There's no way that will equal null, since you're adding the empty strings. Do this:

    if (cChoice == null)

    then (med.value = " ")




    There is no "then" keyword in JavaScript.

    else (med.value = ""+ cChoice +"")




    The code might look like this:

    if (cChoice == null) med.value = "";
    else med.value = cChoice;

    George
    George_Johnson@adobeforums.com Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139