Search the Community
Showing results for tags 'requiredvalue'.
-
Here are some questions that crossed my mind while reading Chapter 5 (Version 0.5) Page 86 The book states, "If you also set a requiredValue attribute for the item in question, your error message can indicate what the required value is via {value}." My question: Larry, could you please provide an example showing how the value of {value} would be set? Page 91 Please show the code I would need to "create user-related scenarios for changing passwords". Also, in which circumstances would I set a scenario on an existing instance, as opposed to creating a new user? Page 93 Why is it necessary to write "filter" twice in this code: 'filter', 'filter'=>'strip_tags' ? Page 94 Wouldn't declaring search terms as safe be a security risk? Here is the code from the book: array('id, user_id, live, title, content, date_updated, date_published', 'safe', 'on'=>'search'), Page 95 Why would we need to compare passwords if the user is only just registering? How would he/she already know a password? Quoting from the book: // Password must match the comparison: array('pass', 'compare', 'compareAttribute'=>'passCompare', 'on'=>'register'), Page 95 I have read a credible article on the Internet stating that ENUM fields are "evil". If I prefer to avoid using an ENUM field, and instead use a separate table of "types" which lists these values 'public','author','admin' etc, and the table has a one to many relationship with User.type, how would I obtain the values from the types table for use in this rule? Here is the code from the book: array('type', 'in', 'range'=>array('public','author','admin')), Page 97 The book states: "Also, when you have a model that’s not based upon a database, you’ll need to add the attribute names and values to the attributeLabels() method yourself." How do these attribute labels end up being incorporated into various HTML forms? Page 101 Quoting from the book: $this->user_id = Yii::app()->user->id; My question: I understand the relationship, but aren't there many user.id values to choose from? How does the framework know which id is the correct one? Page 102 Here's a syntax question: 'date_entered' in the first example becomes $this->created in the second example. How can these refer to the same table field? Page 102 Can you please provide an example how I could "return false in the event handler method"? Quoting from the book: "As a final note on this concept, if the event that’s about to take place shouldn’t occur–for example, the model should not be saved for some reason, just return false in the event handler method." Thanks.
- 1 reply
-
- requiredvalue
- scenarios
-
(and 8 more)
Tagged with: