Expand my Community achievements bar.

If Then Statement Using A Drop Down

Avatar

Former Community Member

if

(This.rawValue == 2)

{

ddlServerBeingMigratedTo.presence

= "visible";

}

else

{

ddlServerBeingMigratedTo.presence

= "hidden";

}

Very Simple Situation.  If someone selects item 2 from the drop down menu which is the value for the word Migration I want the code to set the presense of ddlServerBeingMigratedTo to visible.

This code doesn't work for me.  No errors, no syntax problems.  I tried quotes, and no quotes, and tried using "Migration" in quotes, and I tried using the DDL name instead of this.rawvalue.  Still can't figure it out.

Any suggestions?

1 Reply

Avatar

Level 10

Hi,

A couple of things to check:

  • The test "This.rawValue" should read "this.rawValue"
  • Check what event you have the script in. If it is in the exit event then testing rawValue is OK. But if it is the change event then you would need to test against the newText;
  • Check the language, Javascript. Although if it was set to FormCalc you would have got an error;
  • Check the specified values in the Object / Binding tab;
  • Have a look in the Javascript console (Control+J) for errors;
  • Check the SOM for the object you are referencing in the script. 

You probably have these in hand already, but it is the only thing that may be off, given that the script looks OK.

Good luck,

Niall