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

Prevent submission in no targets selected #1485

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

1v4n4
Copy link
Member

@1v4n4 1v4n4 commented May 9, 2024

@tttp
Copy link
Member

tttp commented May 9, 2024

I'm not a fan of your approach, could you either

  • add an hidden field "targetCounts" with a custom validation that set the value to the number of targets and returns an error if missing

  • or use the resolver:
    and use props.extraValidation (as we do for extraFields)

    resolver: async (data) => {
    // Perform normal validation using the default resolver
    const { errors } = await validate(data);
    const extraErrors = props.extraValidation && props.extraValidation(data);
    if (extraErrors)
    return {...errors, ...extraErrors};
    // Return the errors
    return errors;
    }

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

Successfully merging this pull request may close these issues.

2 participants