Recent Posts by Bill Mers
|
Apr 25, 2008
|
Topic: General Ruby/Rails Discussion / nice, dry, validator? Ah, I actually did try that one, I just forgot about it. :) It works as advertised, however it doesn’t support error messages, it just changes the CSS class of the invalid element, so you can highlight it in red (for example). I need something a little more robust where I can notify the user with a specific error message. I searched high and low for a Rails solution for the client-side number formatting but couldn’t find one. Write my own plugin?! But I’m sooooo lazy, I thought that was the beauty of Rails? :) A pure JS solution is cool though, I’ll definitely take a look at what it takes to turn it into a plugin, sounds like an interesting project. Thanks! Bill |
|
Apr 25, 2008
|
Topic: General Ruby/Rails Discussion / nice, dry, validator? Hey guys I have a forms-heavy site I’m building out that has a requirement for both server-side and client-side validations. Server-side is no problem, that’s already baked into core Rails. I’ve found a great cross-browser solution for the client (www.livevalidation.com), but it requires me to write my validation rules again, which isn’t very DRY. I would just suck it up, but I’m looking at literally thousands of input fields. (It’s a corporate intranet site, so don’t worry, the general public won’t be punished with this.) This purports to have the exact solution, integrating model validation with LiveValidation, however it doesn’t work for me on Rails 2.0.2: http://livevalidation.rubyforge.org/ As a side requirement, I need to be able to reformat user inputs into humanized numbers on the fly client-side, and I don’t have a solution for that yet. For example, the user enters 1023.12, and it should get automagically reformatted to $1,023.12. Any thoughts there? Thanks in advance for any help! I’ve been coding in .NET for the last 5 years and this is my first Rails project, so apologies if these are braindead questions. Cheers, Bill |