97
Phalcon Forms
It handles creation and maintenance of forms in the web application. Now, as we have designed a basic web-app before we would be adding signup form.
Designing Signup form
Change the index.phtml viewfile, add the signup page link as a controller.
app/views/index/index.phtml
OUTPUT:
Now, we write the signup controller
app/controllers/SignupController.php
Initializing Form
In this form, we provide the form definition i.e. structure of form is provided.
app/views/signup/index.phtml
OUTPUT
Validating Form
Phalcon forms are integrated with the validation component to offer instant validation.
Form Elements
Phalcon provides a set of built-in elements to use in your forms. All these elements are located inside PhalconFormsElement.
Name | Description |
---|---|
PhalconFormsElementText | Generate INPUT[type=text] elements |
PhalconFormsElementPassword | Generate INPUT[type=password] elements |
PhalconFormsElementSelect | Generate SELECT tag (combo lists) elements based on choices |
PhalconFormsElementCheck | Generate INPUT[type=check] elements |
PhalconFormsElementTextArea | Generate TEXTAREA elements |
PhalconFormsElementHidden | Generate INPUT[type=hidden] elements |
PhalconFormsElementFile | Generate INPUT[type=file] elements |
PhalconFormsElementDate | Generate INPUT[type=date] elements |
PhalconFormsElementNumeric | Generate INPUT[type=number] elements |
PhalconFormsElementSubmit | Generate INPUT[type=submit] elements |
Next TopicPhalcon Images