SimpleForm component order #25

bcardarella opened this Issue Mar 31, 2011 · 4 comments


None yet

2 participants


Currently ClientSideValidations assumes the :error message to be the last in the stack. However, SimpleForm allows this order to be overridden. The order should be respected.


Well, I guess is something to be done, maybe it is a bit complicated (match the ruby symbols to rendered elements, keeping in mind that you can modify the output with non-standard configurations, etc). In the meantime I got it working with the approach I just added to the wiki. Hope it help others.


Yeah, I'm thinking it can be something as simple as returning the index number for the :error in the array then using that to help decide the order for rending the error. Thanks for the update in the wiki! :)


Also, in response to the note in the wiki: the settings aren't available in the clientSideValiations object because they are per-form settings. the clientSideValidations object is global, but the settings variables are not. However, you can still access the settings from that callback like this:

var settings = window[element.form().attr('id')];
@bcardarella bcardarella was assigned Apr 10, 2011

I'm closing this. If someone changes the component order they should just overload the SimpleForm add and remove rails.validations.js functions. Coding something up that is smart enough to properly insert in a particular order and be aware of custom components is just too hairy.

@bcardarella bcardarella closed this May 9, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment