forms icon indicating copy to clipboard operation
forms copied to clipboard

Exclude :submit from validation

Open mark-31 opened this issue 8 years ago • 6 comments

Element :submit does not contain validation rules.

  • bug fix? yes
  • new feature? no
  • BC break? no

mark-31 avatar Feb 20 '17 13:02 mark-31

Which bug it fixes?

dg avatar Feb 20 '17 13:02 dg

nette-live-form-validation + Bootstrap 3 + .input-group with submit button. IMHO validation on submit is useless.

mark-31 avatar Feb 20 '17 14:02 mark-31

Where exactly is problem? Any side effect?

dg avatar Feb 20 '17 14:02 dg

Example:

<div class="form-group">
   <div class="input-group">
      {input login-password, class => 'form-control'}
      <div class="input-group-btn">
         <button n:name="submitter-signin" class="btn btn-primary no-live-validation" type="submit">
            <i class="fa fa-sign-in"></i>
         </button>
      </div>
   </div>
</div>

Class .form-group is parental element for 2 controls. If input:text is empty, parental element has to have class .has-error, but result is adverse, because the submitter is always positive.

mark-31 avatar Feb 20 '17 14:02 mark-31

@dg This PR was originally posted for nette-live-form-validation script ( https://github.com/Robyer/nette-live-form-validation/pull/30 ).

Is there a reason why submit is not ignored (as this PR proposes)? Or you don't want to merge this just because it doesn't make any real change for netteForms.js itself? I haven't used nette for a while so I can't really tell what side-effects this could cause (if any).

Robyer avatar Mar 04 '17 11:03 Robyer

I understand what the problem is. The same thing can happen if two inputs are together in one form-group, so a better solution is the error state only to turn on, not to turn off.

dg avatar Jun 21 '17 07:06 dg