Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field value change event #131

Open
Destroy666x opened this issue Feb 14, 2024 · 0 comments
Open

Field value change event #131

Destroy666x opened this issue Feb 14, 2024 · 0 comments

Comments

@Destroy666x
Copy link

Destroy666x commented Feb 14, 2024

Would be nice if there was a way to subscribe to all kind of field value changes, Currently, if I;m not mistaken, you have to do:

config.onOpen = function() {
  let reverseGeocodingAPIField = this.fields.reverseGeocodingAPI.node;
  let changeReverseGeocodingAPIVisibility = value => {
    if (value === 'BigDataCloud') {
      this.fields.bigDataCloudAPIKey.wrapper.style.display = '';
    } else {
      this.fields.bigDataCloudAPIKey.wrapper.style.display = 'none';
    }
  };

  changeReverseGeocodingAPIVisibility(reverseGeocodingAPIField.value);

  reverseGeocodingAPIField.addEventListener(
    'change',
    event => changeReverseGeocodingAPIVisibility(event.target.value)
  );
}

to check both initial state and then changes. Not too clean if yyou did that for a bunch of fields.

It could be e.g.: config.fieldName.onValueChange/config.fields.fieldName.onValueChange or something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant