Using lead form values to dictate form field visibility rules
Hello!
I am trying to make a form field visible only if there is a null value for another field in our instance. I have tried to implement using this thread: Form field conditional on current vlaue. However when I test it doesn't seem to work, the form value that I am trying to hide/show ( IS Agency) keeps showing no matter what.
The form I am trying to do this for has Is agency as the field with visibility rules, based on a hidden field that is "IsAgencyDynamic". Prefill is enabled for both fields, and Is Agency has the below visibility rules. I have implemented this JS and form on this landing page. Can you help me identify why this is not working? Thanks!

Code I am using:
<script>
MktoForms2.whenReady(function(form){
form.setValues({
IsAgencyDynamic : form.getValues().IsAgency
});
})
</script>