I’m finding things that are close but either they are Rail 2.x and don’t work in 3 or they are different enough that I’m spending a ton of time trying to figure out how to rework them.
Here’s what I want to do. We have two type of people, member and guest. Member have member numbers and get a discount. What I like to do in the form is when they enter a member number, to a find in the database and if the member number exists, show a green check, if it doesn’t show a red x. This is to improve the experience, rather than having to post the entire form and they pop them back because they fat fingered the member number.
I thought I could use a button_to or a link_to and have them as :remote => true, call a function in the controller and based on that result, unhide the div that contains the image. So of the issues, the function is called but I can’t figure out how to denote success or failure. Or it goes to the show.html.erb page rather than then page I’m on. Or my favorite nothing…
Any help is appreciated. Thanks!
PeopleController
routes.rb
application.js or people.js
first edit.
Obviously, you need to have input field with correct id, member-number, as the javascript i wrote above.