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

Errors not displayed in named forms #222

Open
dirkpostma opened this issue Feb 25, 2016 · 3 comments
Open

Errors not displayed in named forms #222

dirkpostma opened this issue Feb 25, 2016 · 3 comments
Labels

Comments

@dirkpostma
Copy link

I'd like to render multiple forms on a page, form A and form B. They both have a field named 'somefield' field, that has some validation rules. When I submit form A and validation failed, the error is shown in both form A and B. Of course, I only want this error to be displayed in form A.

I read about the option of named forms, http://kristijanhusak.github.io/laravel-form-builder/form/named-form.html, I guess that is meant exactly for my usecase. However, when I set a name on a form, either by passing 'name' as option or by setting the property $name in de form class, I don't see errors at all when validation fails.

Questions:

  1. Is using named forms the way to go for my use case?
  2. If so: how should I get it working?
@kristijanhusak
Copy link
Owner

Yes, named forms should be the way to go, but it's really strange that errors are not shown. I'll check it out, thanks for reporting.

@terrasoff
Copy link

Errors come from response are just flat array. No mentions about form name :(
But actually 'Validator' knows form name. Not sure if Laravel is able work with named forms correctly.

@wongwangki
Copy link

wongwangki commented Nov 10, 2017

Try to use inline rules instead of $form->validate('min:3|max:255|required') to set the rules

ie:
use: ->add( 'title', 'text', [ 'rules' => 'min:3|max:255|required' ] )

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

No branches or pull requests

4 participants