Skip to content

Conversation

@CyberDeck
Copy link
Contributor

This should contain all relevant changes to reassemble the old PR #345.

Bugfixes:

  • form-control-danger is replaced with is-invalid for bootstrap 4.0.0.beta3
  • form-control-feedback is replaced with invalid-feedback for bootstrap 4.0.0.beta3
  • help texts are rendered with <small> tag instead of <span> tag, i.e. like in bootstrap 4.0.0.beta3

Features:

  • is-valid will be applied to validated form field (i.e. not on unchanged or new records)
  • new custom: true option for radio buttons and check boxes according to bootstrap 4.0.0.beta3

@CyberDeck
Copy link
Contributor Author

CyberDeck commented Jan 11, 2018

Now this PR addresses the action
Remove/replace has_danger, form-control-feedback, and form-control-label
from Issue #361.

if options[:custom]
validation = nil
validation = "is-invalid" if has_error?(name)
validation = "is-valid" if is_valid?(name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

So bootstrap4 added valid states, however I wonder if this is the behaviour we want to support.

I can see this making sense for client side validated forms, but in server side rendered cases it feels a little odd as the field will render with a is-valid class only in the case when the model fails validation error and the form is re-rendered, not at the point when a user inputs content in the fields.

What's everyones opinion on this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like the right thing to, just as it was before, just with the new classes.

Copy link
Collaborator

@donv donv Jan 11, 2018

Choose a reason for hiding this comment

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

Sorry, didn't read the context of this comment. Now I am not so sure. I think marking the valid fields is OK, but only marking the invalid fields is better. Actually, for red/green color blind users, only marking the invalid fields helps them stand out. I think it is good either way :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

A quick test in a real app showed me that marking valid fields with green looks OK, but does not improve the UX, really.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should leave out is-valid for this PR. I don't see myself using it for server-side validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just removed the 'is-valid' class within the PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup, definitely feels like the right behaviour. Thanks for the great work @CyberDeck!

donv
donv previously requested changes Jan 11, 2018
CHANGELOG.md Outdated

Features:
- Your contribution here!
- is-valid will be applied to validated form field (i.e. not on unchanged or new records)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not true anymore, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I will remove it.

@desheikh desheikh added this to the 4.0.0 milestone Jan 11, 2018
This was referenced Jan 12, 2018
@mattbrictson mattbrictson changed the title New PR to replace PR #345 Change form validation to support Bootstrap 4.0.0.beta (replaces #345) Jan 12, 2018
@mattbrictson
Copy link
Contributor

@donv @desheikh is this ready to merge?

@desheikh desheikh dismissed donv’s stale review January 12, 2018 17:10

Changelog edit done

@desheikh
Copy link
Collaborator

Looks good from my end

@mattbrictson mattbrictson merged commit 796bd76 into bootstrap-ruby:master Jan 13, 2018
@mattbrictson
Copy link
Contributor

Thanks for the PR and congratulations on your first contribution to the project! 🎉

@CyberDeck CyberDeck deleted the validation branch January 13, 2018 20:08
lcreid pushed a commit to lcreid/rails-bootstrap-forms that referenced this pull request Jun 4, 2018
…strap-ruby#345) (bootstrap-ruby#370)

* New PR to replace PR bootstrap-ruby#345

* Removed has_danger and form-control-label

* Removed 'is-valid'

* Removed wrong line from Changelog

* Update html help test with latest v4 help markup
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.

4 participants