Hello All,
For a start, this is my database -
CREATE TABLE IF NOT EXISTS `client` (
`id` int(11) NOT NULL auto_increment,
`ClientID` int(11),
`LastName` varchar(50) default NULL,
`FirstName` varchar(50) default NULL,
`Street` varchar(75) default NULL,
`City` varchar(75) default NULL,
`prov_state` varchar(50) default NULL,
`zip_postal` varchar(10) default NULL,
`email` varchar(75) default NULL,
PRIMARY KEY (`ID`),
KEY `email` (`email`)
) TYPE=MyISAM AUTO_INCREMENT=3 ;
I have a view page with a form, where there is an input text field as below:
Here's my Controller -Code:<form method=post action="checkclient" name="loginform"> <input type="text" name="clid" style="border-style:solid; border-color:#CCCCCC;"> <input type=submit onclick="return validateForm()"> </form>
I open the above HTML form (loginform), input my id, and gives it to ClientinfoController > checkclient. But this gives me the following error:Code:class ClientinfoController < ApplicationController model :clientinfo scaffold :clientinfo def index render_text "Boo" end def edit @clientinfo = Clientinfo.find(@params["id"]) end def checkclient userid = params[:clid] @clientinfo = Clientinfo.find_all(["ClientID = ?", userid]) render_text @clientinfo.LastName end end
undefined method `LastName' for #<Array:0x3a05610>
This works though, if I replace @clientinfo.LastName with @clientinfo.inspect, and it throws out the whole array on the page. It doesn't take any of the database parameters. So it's something silly that I've missed out somewhere.
I've tested another form which takes on the "edit" method above, and that works fine for me.
I'm using Webbrick on my local system - haven't tried this piece on Apache yet.
Could you guys help me on this please?
Sax.





Bookmarks