I just though I would let you know that i used your guys suggestions and now my login is being set correctly. Thanks guys.
On Apr 30, 4:41 pm, Peter Bell <[EMAIL PROTECTED]> wrote: > And if you were taking that approach, you could save a little code by > changing the second half to: > arguments.bean.load( qRead); > > That would loop through all of the columns in the recordset, calling > the appropriate custom setters or setting the properties if there > wasn't a custom setter for a given property. > > Also means you can use the same base code for loading all types of > beans . > > That said, I might start with Dans approach, and you can then look for > duplication in your code and refactor it once it's up, running and > working. > > Best Wishes, > Peter > > On Apr 30, 2008, at 5:36 PM, Dan Wilson wrote: > > > Hi Brian, > > > Oddly enough, your code is working as it should. > > > In your init function, you have all of the arguments, setters and > > such that make up the attributes of the bean. When the init() > > function runs, it sets up all of these attributes, either passing in > > the specific argument, or setting the value to an empty string. An > > init() function is classically responsible for initializing a bean > > object. When something is initialized, it is set to a default state. > > > Now, you state you are calling your init function INSIDE the DAO, > > after the bean has been initialized. This is an incorrect usage of > > the init function because you aren't trying to initialize the > > object, you are trying to set some of the attributes of the bean. > > You should be using the setters on the bean to accomplish this. > > > <cfquery name="qRead" datasource="#getConfig().dsn#"> > > SELECT > > AreaID, > > SurveyCycleID, > > AreaName, > > AreaInstructions, > > IsAdminOnly, > > CreatedBy, > > CreatedOn, > > LastUpdateBy, > > LastUpdateOn > > FROM area > > WHERE AreaID = <cfqueryparam > > value="#arguments.Bean.getAreaID()#" CFSQLType="cf_sql_integer" /> > > </cfquery> > > <cfset arguments.bean.setAreaID( qRead.AreaID ) /> > > <cfset arguments.bean.setAreaName( qRead.AreaName ) /> > > <cfset arguments.bean.setCreatedBy( qRead.CreatedBy ) /> > > <cfset arguments.bean.setCreatedOn( qRead.CreatedOn ) /> > > > DW > > > On Wed, Apr 30, 2008 at 5:17 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED] > > > wrote: > > > Hi guys, > > Just a little introduction since I am new to this group. My name is > > brian and I am a coldfusion OO newbie. I've been developing a Mach-ii > > cms app for my organization also using coldspring, so I've been on the > > mach-ii group quite a bit, as well as the coldspring one. But anyway, > > on to the problem. > > > I've been having this issue with the getRememberme() function > > in my user bean returning the default value which is false (its > > boolean) in the validateUser() function of my login service even after > > being set to true. > > > I am first initializing the user bean upon the submission of a form. > > Using mach-ii, I am populating the bean with the user's email and > > password, as well as a remember me attribute. You know, that check box > > usually found underneath the username and password fields. When > > checked, this sets the value in my bean to 'true'. > > > The partially populated bean is then being passed into my model as an > > argument, specifically the loginService which delegates to the > > userService which then passes the bean to the userDAO, performing the > > query, and calling the bean's init() function. The query data is then > > passed to the init() function of my bean once again to populate it > > with the necessary data. The problem is that when the init() function > > is called in my DAO to pass it the query data, the rememberme variable > > is being reset to false (the default value) since no data is being > > passed to it from the database. > > > Now, I origionally posted this question in the coldspring forum where > > it was suggested that this was a question more suited to this group. > > One reply mentioned using a load() function. In my > > research of beans I have not come across this as being a function > > found in a bean. Is this a function that I should consider adding, or > > is there a better way of doing this? > > > -- > > "Come to the edge, he said. They said: We are afraid. Come to the > > edge, he said. They came. He pushed them and they flew." > > > Guillaume Apollinaire quotes --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
