Expand my Community achievements bar.

SOLVED

Hiding Button if Conditions are met

Avatar

Level 2

I have a form that has 3 drop down boxes with options 1,2 and 3 in them.  I want to hide a button if "1" is selected for either of the 3 drop down boxes.  But the problem is I want it to re appear if the user changes their mind and wants to select 2 or 3.  So at no point and time do I want the button visible if "1" is selected.  But I do want it visible if  none of the boxes have "1"or are blank.

Thanks in advance for taking the time to help.

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi,

The script itself will work. Not sure what is preventing it from giving you the results you need without seeing it (i.e. it has to do with something other than the structure of the script itself).

Check the following:

  • Set the bound values as numbers on all the drop-downs: 1,2,3 in the Binding Tab of the Object  Pallet
  • Make sure the reference syntax is correct--if the drop-downs reside in a different subform or different row in a table, you'll need to make changes.
  • Make sure you've chosen formCalc on all  drop-downs
  • Make sure you're placing the scripts on the Exit event--must be Exit event, not Change event.
  • Make sure other scripts aren't interfering--perhaps there are scripting attempts you've forgotten to remove
  • Use the "Check Script Syntax" button feature in the Script Editor
    • Look at the log for any clues to guide you.

    This is the best help I can offer without seeing the form.

    Good luck,

    Stephen

    View solution in original post

    4 Replies

    Avatar

    Level 7

    Hi uschad123,

    Here's a way to do it:

    Set the bound values as numbers: 1,2,3 in the Binding Tab of the Object Pallet

    then using formCalc you put a script "like" this on the "exit" event on all 3 drop-down boxes:

    ////////////////////// formCalc:

    if ($ le "1" | ddl2 le "1" | ddl3 le "1") then

         button1.presence = "hidden"

    else

         button1.presence = "visible"

    endif

    ////////////////////

    you'll need to adjust the script slightly for each drop-down box. My example uses formCalc, but javaScript is just as easy.

    ////////////////// javascript:

    if (this.rawValue <= "1" || ddl2.rawValue <= "1" || ddl3.rawValue <= "1")

    {

          button1.presence = "hidden";

    }

    else

    {

         button1.presence =  "visible";

    }

    ////////////////////////////

    also with this, you'll need to adjust the script slightly for each drop-down box.

    Good luck,

    Stephen

    Avatar

    Level 2

    I have made all the adjustments using formcalc but whenever i select a 2 or 3 in the second or third drop down menu the button reappears.  I have made all the necessary changes to the formcalc for each drop down box.

    Thanks for the help.

    Avatar

    Correct answer by
    Level 7

    Hi,

    The script itself will work. Not sure what is preventing it from giving you the results you need without seeing it (i.e. it has to do with something other than the structure of the script itself).

    Check the following:

    • Set the bound values as numbers on all the drop-downs: 1,2,3 in the Binding Tab of the Object  Pallet
    • Make sure the reference syntax is correct--if the drop-downs reside in a different subform or different row in a table, you'll need to make changes.
    • Make sure you've chosen formCalc on all  drop-downs
    • Make sure you're placing the scripts on the Exit event--must be Exit event, not Change event.
    • Make sure other scripts aren't interfering--perhaps there are scripting attempts you've forgotten to remove
    • Use the "Check Script Syntax" button feature in the Script Editor
      • Look at the log for any clues to guide you.

      This is the best help I can offer without seeing the form.

      Good luck,

      Stephen

      Avatar

      Level 2

      Yes sir it works now.  I went back and started over.  I must have had something going on from my previous work.  Thanks for the help and the time.