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

rules for array based form elements as DateSelect #47

Open
cbichis opened this issue May 28, 2017 · 4 comments
Open

rules for array based form elements as DateSelect #47

cbichis opened this issue May 28, 2017 · 4 comments

Comments

@cbichis
Copy link

cbichis commented May 28, 2017

Hi,

I think it would be interesting to have a way to use Stroker Form for cases of elements based on an array as DateSelect:

date[year]
date[month]
date[day]

@bramstroker
Copy link
Owner

With date select a user will always select a valid date, so I don't see why there is a need to validate this client side. Could you elaborate?

@cbichis
Copy link
Author

cbichis commented May 28, 2017

Yes, it could be at least 2 cases for which is needed to validate the input:

  1. If no date is selected at all (but the date is required)
  2. when just some of the data part is set (let's suppose only year has been selected, not also month and day)

I am unsure how the rule should work taking into consideration that there are multiple fields involved, you know better :)

@bramstroker
Copy link
Owner

@cbichis I am also not sure how to implement something like this in a generic way, because both StrokerForm and jquery validate library expects a validator to be attached to one given element.
Could you share your ZF2 snippet how you have coded the form fields and inputfilter right now, than we can think about a possible solution.
However I think a feature like this will be out of scope for this module. You can just create your own custom jquery validate rule and write some javascript code to get the validation you want.

@cbichis
Copy link
Author

cbichis commented Jun 21, 2017

I have 2 dummy cases DateSelect validator can be useful:

  1. To check if the data entered is correct (including if all the subfields - date, month, year has been selected)
  2. For a validator like "you have 18 years" ?

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

2 participants