You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/02/05 05:18:57 UTC
[GitHub] [airflow] yjwong edited a comment on issue #13985: Can't save any connection if provider-provided connection form widgets have fields marked as InputRequired
yjwong edited a comment on issue #13985:
URL: https://github.com/apache/airflow/issues/13985#issuecomment-773795228
Flask-AppBuilder also runs validations for every field when it's submitted. I was not able to find a way to conditionally add/remove fields depending on the submitted `conn_type`, so that means that my PR alone would not work.
However, it's possible for a provider to get it to work using a validator that's conditional on the `conn_type`:
```python
class InputRequired(wtforms.validators.InputRequired):
field_flags = ('required', )
def __call__(self, form, field):
conn_type = form.conn_type.data
if conn_type == MyHook.conn_type:
super().__call__(form, field)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org