checking input data in the form when button clicked..

Hi, I'm trying to check the data in the fields in the form and if valid
save in the corresponding tables in the database. But (as I'm new to
rails) just couldn't figure out how I can do it. Here's how I'm trying
just to check the input data: