Giter Site home page Giter Site logo

Comments (4)

czosel avatar czosel commented on June 10, 2024

Currently we don't support element-specific CSS classes.

We could discuss adding a class property to the label and input components, but that won't solve your case completely because you'd like your input to be wrapped inside a div.

You could try using custom input and label elements (see docs) to achieve this. It might look roughly like this:

{{#f.input label-component=(...) as |fi|}}
    <input
      type        = "text"
      value       = {{fi.value}}
      class       = "col-md-2"
      oninput     = fi.update
      onblur      = fi.setDirty
      >
  {{/f.input}}

/cc @anehx

from ember-validated-form.

mostafahussein avatar mostafahussein commented on June 10, 2024

@czosel Thanks for pointing me to this. Currently I wrote it as the following as i find it easier to customize through html:

<div class="form-group">
  <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Name <span class="required">*</span>
  </label>
  <div class="col-md-6 col-sm-6 col-xs-12">
    {{#f.input name="name" as |fi|}}
      <input type = "text" value = {{fi.value}} class = "form-control col-md-7 col-xs-12" oninput = {{ fi.update }} onblur = {{ fi.setDirty }} >
    {{/f.input}}
  </div>
</div>

The UI rendering as expected but I am getting the following error while typing in the text box

"Assertion Failed: You attempted to access the `length` property (of changeset:[object Object]).
Since Ember 3.1, this is usually fine as you no longer need to use `.get()`
to access computed properties. However, in this case, the object in question
is a special kind of Ember object (a proxy). Therefore, it is still necessary
to use `.get('length')` in this case.

If you encountered this error because of third-party code that you don't control,
there is more information at https://github.com/emberjs/ember.js/issues/16148, and
you can help us improve this error message by telling us more about what happened in
this situation.

Also I cannot get the value that was typed in the textbox.

What should I do ?

I am using ember 3.3

from ember-validated-form.

mostafahussein avatar mostafahussein commented on June 10, 2024

I have solved the issue thank you!, should we close this or leave it open as a reminder for the custom css support ?

from ember-validated-form.

czosel avatar czosel commented on June 10, 2024

Awesome! How did you solve it?
I'll close the issue, since custom CSS support wouldn't have covered your use-case.

from ember-validated-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.