Hi all,
I have a file upload SAIL component and I only want it to be visible when a certain condition is true.
a!fileUploadField( label: "Upload Documents")
I would like it to only show when the stage is 2, and I wrote the following SAIL code but it doesn't seem to be working.
ShowWhen: if(local!formStage = 2, true, false)
Ehm, what is the correct syntax for setting the visibility property?
Thanks.
Discussion posts and replies are publicly visible
The syntax works for me. You may want to check if the fileUpload SAIL component and/or the local variable is in the with() section of your form, otherwise, changes to the local variable won't affect the visibility of the file upload component as intended
Reggie is right, you are using showWhen correctly. Another thing to check might be to include a textField that's only temporarily there for display purposes to show you the current value of formStage just to confirm there isn't something unexpected going on with that.
Local variables are also dynamically typed, so you may want to make sure it's not a Text or a Decimal too.
Just to follow up as it'll save you loads of typing in the future. You do not need the while if() statement. Since local!formStage=2 is either true or false, that's all you need to test:
ShowWhen: local!formStage = 2
It's much easier to read as well!