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

Two fields, at least one is required #235

Open
bernhardflokstra opened this issue Feb 15, 2018 · 2 comments
Open

Two fields, at least one is required #235

bernhardflokstra opened this issue Feb 15, 2018 · 2 comments

Comments

@bernhardflokstra
Copy link

I have a form I'm using GUMP to validate. Form as 10 fields, 2 of which are for phonenumbers (1 cellphone, 1 landline). Can I make it required to have at least one of them filled out?

So I want my users to have the option to either have both filled out of one of the fields. If neither is filled out the form should not be valid. Is this posible?

@filisko
Copy link
Collaborator

filisko commented Feb 28, 2018

Yes, that's an interesting thing to have, I will have a look

@sitenzo
Copy link

sitenzo commented Jun 23, 2020

Is there any progress on this validator?

I have looked at the code because i need this for validation.

For now i'm stuck at these 2 lines gump.class.php#L450 gump.class.php#L452

Whe a field is empty, it skipps the field because it is not required.
If we van add data to gump.class.php#L555 this array we can add or own validator to this.

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

No branches or pull requests

3 participants