Trouble creating a custom wrapper

20 views
Skip to first unread message

cam...@automatedinsights.com

unread,
Apr 7, 2016, 11:50:11 AM4/7/16
to SimpleForm
Hello,

I have created a custom wrapper for a form element using material design lite. I'm able to get everything working correctly except for the error class on the wrapper div. Here is my wrapper code:

config.wrappers :mdl, class: 'form-inputs mdl-textfield mdl-js-textfield mdl-textfield--floating-label', error_class: 'is-invalid' do |b|
    b.use :html5
    b.use :placeholder
    b.optional :pattern
    b.use :input, class: 'mdl-textfield__input'
    b.use :label, class: 'mdl-textfield__label no-margin'
    b.use :error, wrap_with: { tag: :span, class: 'mdl-textfield__error' }
  end

The problem that I have is that the error class on the outer wrapper ("is-invalid") gets stripped. I've tried several other classes and those work fine ("is-valid", "error", etc). I've also applied the "is-invalid" class to the error span (second to last line) and that works fine. 

Is there something unique to the error_class on the wrapper that prevents me from using the word "invalid"?
Reply all
Reply to author
Forward
0 new messages