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

If a form field is not required, it won't have any client validation enabled #379

Merged
merged 5 commits into from
Sep 7, 2017

Conversation

koichirose
Copy link
Contributor

Just checked this with inputs and textareas.

This produces nothing:

'rules' => 'max:25',

This produces required="required" maxlength="25"

'rules' => 'required|max:25',

I very quickly created this PR, but I'm not sure it's actually a bug.

What do you think?

$attrs = $this->getOption('attr') + $parsedRules;
$this->setOption('attr', $attrs);
}
if ($this->parent->clientValidationEnabled()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move $parsedRules into this if to avoid double nesting:

if ($this->parent->clientValidationEnabled() && $parsedRules) {
  $attrs = $this->getOption('attr') + $parsedRules;
  $this->setOption('attr', $attrs);
}

@kristijanhusak
Copy link
Owner

@koichirose looks like it is. Can you just fix what i left in the comment, and i'll merge it in. Thanks!

@koichirose
Copy link
Contributor Author

Done! Thanks

@kristijanhusak kristijanhusak merged commit a812573 into kristijanhusak:master Sep 7, 2017
@kristijanhusak
Copy link
Owner

Thank you!

@Luukvdo Luukvdo mentioned this pull request Oct 12, 2017
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.

None yet

2 participants