Preface - Instant Building Multi-Page Forms with Yii How-to (2013)

Instant Building Multi-Page Forms with Yii How-to (2013)

Preface

Instant Building Multi-Page Forms with Yii How-to is a simple and descriptive how-to that provides step-by-step recipes to help you convert your lengthy forms into short, interactive forms. It will show you the inbuilt features of the Yii framework to help you with this tricky task.

What this book covers

Getting started with Yii (Simple) helps you set the Yii environment and create a skeleton of the Yii application.

Connecting to the database (Simple) shows you how to set up a database connection in the Yii application.

Using the Gii tool (Simple) covers the automated code generation features provided by Yii. We will learn how to enable the Gii tool and create Models, CRUD, forms, and application modules.

Creating basic forms (Simple) helps you to create a basic single page form with Yii.

Building multipage forms (Intermediate) shows you how to split your lengthy single page form into multipage forms by validating the form fields and maintaining page data on each page.

Validating forms (Intermediate) gives you details on the form field validation helpers provided by Yii. We will look at various validation helpers, use validation rules provided by Yii, and set our own validation rules.

AJAX forms (Advanced) helps you enable AJAX support for forms. We will take a look at the AJAX helpers provided by Yii, AJAX-based form field validations, and AJAX-based form submission.

Uploading files (Advanced) covers the file upload features provided by Yii. We will look at how to file field validations and restrict uploads to specific file types.

Using multiple models (Intermediate) helps you learn the use of multiple models in a single form.

Customizing looks (Advanced) shows you the options provided by Yii to customize the look of forms. Additionally, we will learn how to create and use skins and customize widgets using the widget factory.

What you need for this book

To use the recipes, tips, and tricks of this book, you need to have the following:

· A web server (any web server with plugins to process PHP scripts)

· PHP version 5.2 + (5.3 recommended)

· A database server (the book has been written with MySQL in mind, but you can easily choose a relational database server of your choice)

· Yii Framework

Who this book is for

This book is great for developers who have a basic understanding of the Yii framework and want to learn about the advanced inbuilt features of Yii. It assumes that the reader has a basic knowledge of PHP development, the working of forms, and AJAX operations.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: " As we need the same form elements in actionCreate and actionUpdate, Yii has created a single file _form.php that contains all the form elements."

A block of code is set as follows:

'modules'=>array(

// uncomment the following to enable the Gii tool

/*

'gii'=>array(

'class'=>'system.gii.GiiModule',

'password'=>'root',

// If removed, Gii defaults to localhost only. Editcarefully to taste.

'ipFilters'=>array('127.0.0.1','::1'),

), */

),

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

'modules'=>array(

// uncomment the following to enable the Gii tool

/*

'gii'=>array(

'class'=>'system.gii.GiiModule',

'password'=>'root',

// If removed, Gii defaults to localhost only. Editcarefully to taste.

'ipFilters'=>array('127.0.0.1','::1'),

), */

),

Any command-line input or output is written as follows:

yii> framework/yiic webapp webRoot/sampleapp

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.