HTML forms are one of the key pieces of any website. As is the case with many things, creating forms while using a framework such as Yii is significantly different than creating forms using standard HTML alone. In Chapter 9, “Working with Forms,” of “The Yii Book“, you’ll learn what you need to know to create HTML forms when using the Yii framework. You’ll comprehend the fundamentals of forms in Yii and see a few recipes for common form needs.
Continue Reading...Archives For form
HTML forms are one of the key pieces of any Web site, providing an easy way to get data from the user. But, as is the case with many things, creating forms while using a framework such as Yii is significantly different than creating forms using standard HTML alone. In this post, you’ll learn what you need to know to get started creating HTML forms when using the Yii framework. Continue Reading…
Normally two Models in an MVC architecture are related to each other, such as Employees and Departments (to use the classic example), where each employee is in one department and each department has multiple employees. Although Yii does a great job of auto-generating most of the code you need, including the form used to create and update a Model, the Yii-generated form won’t properly represent the related Model. In this post I’ll walk you through what you need to do to make your forms work properly for related Models. Continue Reading…
On a recent Yii-based project, managing one of the Models required a whole slew of checkboxes to indicate that yes, the quality does apply, or no, it does not. In this case, the value being stored in the database for each attribute was a single letter: Y/N. However Yii, when showing the form to update an item, needs the checkbox value to be a Boolean, in order to properly pre-check the box. Changing the database wasn’t an option in this case, so I had to figure out a good conversion process. In this post, I’ll tell you exactly how I solved this issue. Continue Reading…