Code Monkey home page Code Monkey logo

Comments (17)

timsayshey avatar timsayshey commented on May 20, 2024

I love the idea!

Would it have settings for placement (before/after), adding a class, appending/prepending, etc?

from cfwheels.

andybellenie avatar andybellenie commented on May 20, 2024

Yes. It would avoid the need to do stuff like this:

#textField(objectName="sale",
    property="telMobile", 
    labelClass="control-label",
    prependToLabel="<div class='control-group'>", 
    appendToLabel="<div class='controls'>",
    append="#errorMessageOn(objectName="sale", property="telMobile", class="help-inline")#</div></div>")#

from cfwheels.

rip747 avatar rip747 commented on May 20, 2024

LOOOOOOOOVING THIS IDEA!!!!!

however I have some suggestions :)

  1. There needs to be some way to disable it if need be. Maybe an error="false" argument or something.
  2. I would propose that errors be always outputted but have a display:none; style or class="hidden". the reason for this, is that it would make it easier for devs (and us eventually) to use javascript for client side validation. by doing this the dev would simply need to remove the css styling to display the error message instead of having to recreate it with javascript. futhermore it would be nice to have classes on the errors to help recognize the errors like [objectName-propertyname] [validationtype] ie:

class="user-password confirmationof"

this way if more then one error existing, you can target it better with javascript.

thoughts?

from cfwheels.

andybellenie avatar andybellenie commented on May 20, 2024
  1. Yes absolutely.
  2. As with the label, the class on the element could be set via a prefix (e.g. errorClass="xx"). Visibility of the element could then be easily managed.

from cfwheels.

rip747 avatar rip747 commented on May 20, 2024

it would be impossible to do this manually. how would you set the errorClass for say two errors (confirmationOf and presitenceOf) on a password field. you can only pass in one errorClass argument to the passwordField() helper method.

from cfwheels.

rip747 avatar rip747 commented on May 20, 2024

What wheels should do is automatically add the [objectName-propertyname] [validationtype] class name to the errors and all the errorClass argument does is add your defined classes to each error. in other words, wheels would add:

class="user-password confirmationof"

to each error. if you set the errorClass argument to say tony, then class attribute of the errors would be:

class="user-password confirmationof tony"

from cfwheels.

andybellenie avatar andybellenie commented on May 20, 2024

Doesn't errorMessageOn() only ever display one error per property?

from cfwheels.

rip747 avatar rip747 commented on May 20, 2024

errorMessageOn returns an array of all errors for that property:

https://github.com/cfwheels/cfwheels/blob/new-master/wheels/view/errors.cfm#L48
https://github.com/cfwheels/cfwheels/blob/new-master/wheels/model/errors.cfm#L97

from cfwheels.

andybellenie avatar andybellenie commented on May 20, 2024

That's errorMessagesFor()

Sent from my iPhone

On 15 Nov 2012, at 21:42, Anthony Petruzzi [email protected] wrote:

errorMessageOn returns an array of all errors for that property:

https://github.com/cfwheels/cfwheels/blob/new-master/wheels/view/errors.cfm#L48
https://github.com/cfwheels/cfwheels/blob/new-master/wheels/model/errors.cfm#L97


Reply to this email directly or view it on GitHub.

from cfwheels.

rip747 avatar rip747 commented on May 20, 2024

Errormessagesfor gives back.an array of.all the.errors on the model.
Errormessageson gives back an array of errors for a particular property.
On Nov 15, 2012 6:19 PM, "Andy Bellenie" [email protected] wrote:

That's errorMessagesFor()

Sent from my iPhone

On 15 Nov 2012, at 21:42, Anthony Petruzzi [email protected]
wrote:

errorMessageOn returns an array of all errors for that property:

https://github.com/cfwheels/cfwheels/blob/new-master/wheels/view/errors.cfm#L48

https://github.com/cfwheels/cfwheels/blob/new-master/wheels/model/errors.cfm#L97


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/107#issuecomment-10430197.

from cfwheels.

andybellenie avatar andybellenie commented on May 20, 2024

http://cfwheels.org/docs/1-1/function/errormessageon

from cfwheels.

rip747 avatar rip747 commented on May 20, 2024

my bad, I should have said errorsOn.

from cfwheels.

perdjurner avatar perdjurner commented on May 20, 2024

This is plugin material :)

from cfwheels.

timsayshey avatar timsayshey commented on May 20, 2024

I actually think Chris Peters bootstrap form helpers plugin has this:
https://github.com/liquifusion/bootstrap-cfwheels

from cfwheels.

chrisdpeters avatar chrisdpeters commented on May 20, 2024

simple_form for Rails provides this. Their way of configuring forms is pretty nice, and I like that they have a generator for Bootstrap (though I wish there was one for Foundation too).

from cfwheels.

chrisdpeters avatar chrisdpeters commented on May 20, 2024

I stand corrected: looks like they finally made a generator for Foundation 5.

from cfwheels.

perdjurner avatar perdjurner commented on May 20, 2024

Closing this as we're using the issue tracker for bugs only from now on.
Please implement your feature suggestion as a plugin or make a pull request.
If you need feedback before starting, please consult the Google Group.

Thanks.

from cfwheels.

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.