Closes: Fieldset validator for releated fields #2551
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This feature adds additional validator that work for multiply fields.
This is a new validator that works for a set of fields that are related to each other. Based on the value of one field, it can validate a subset of fields for that value.
For example, in a purchase contact information form, we need different values for a company and a person. So, we add a 'select' field where we can choose whose details we need: either a person or a company. Then, we add fields for both individuals and companies. The validator will only validate the fields indicated by the first 'select' field.
Which issue(s) this PR closes:
It comes from Fairbirds team.
Example usage:
#datasetField name title validation
responsible_party Responsible party "[{""name"":""standard_input""}]"
responsible_party_type Type "[{""name"":""standard_input""}]"
responsible_party_person_first_name First name "[{""name"":""required_by_value_dependant"",""parameters"":{""context"":[""DATASET""], ""runOnEmpty"":""true"", ""dependantField"": ""responsible_party_type"", ""dependantFieldValue"": ""person""}}]"
responsible_party_person_surnames Surname(s) "[{""name"":""required_by_value_dependant"",""parameters"":{""context"":[""DATASET""], ""runOnEmpty"":""true"", ""dependantField"": ""responsible_party_type"", ""dependantFieldValue"": ""person""}}]"
responsible_party_organization_name Organization name "[{""name"":""required_by_value_dependant"",""parameters"":{""context"":[""DATASET""], ""runOnEmpty"":""true"", ""dependantField"": ""responsible_party_type"", ""dependantFieldValue"": ""organization""}}]"
responsible_party_organization_address_city City "[{""name"":""required_by_value_dependant"",""parameters"":{""context"":[""DATASET""], ""runOnEmpty"":""true"", ""dependantField"": ""responsible_party_type"", ""dependantFieldValue"": ""organization""}}]"
responsible_party_organization_address_postal-code Postal code "[{""name"":""required_by_value_dependant"",""parameters"":{""context"":[""DATASET""], ""runOnEmpty"":""true"", ""dependantField"": ""responsible_party_type"", ""dependantFieldValue"": ""organization""}}]"
responsible_party_organization_address_administrative-area Administrative area "[{""name"":""required_by_value_dependant"",""parameters"":{""context"":[""DATASET""], ""runOnEmpty"":""true"", ""dependantField"": ""responsible_party_type"", ""dependantFieldValue"": ""organization""}}]"
responsible_party_organization_address_country Country "[{""name"":""required_by_value_dependant"",""parameters"":{""context"":[""DATASET""], ""runOnEmpty"":""true"", ""dependantField"": ""responsible_party_type"", ""dependantFieldValue"": ""organization""}}]"
responsible_party_email_address Email address "[{""name"":""standard_input""}]"
responsible_party_orcid ORCID "[{""name"":""standard_input""}]"
#controlledVocabulary DatasetField Value identifier
responsible_party_type Person person
responsible_party_type Organization organization
releatedFieldValidator.csv