Trellon.com: 20 APIs in 20 Days: The Forms API

This post is an entry in our 20 APIs in 20 Days series. Learn more about how best practices lead to sustainable development at www.trellon.com.

There's not much that has not been said about Drupal's Forms API, and it can be a challenging concept for developers who are used to working with other platforms. Any series talking about the underlying framework would be incomplete without some discussion of how it is used.

The Forms API in Drupal provides developers with a way to dynamically construct, modify and secure forms on your web sites. Instead of writing out the markup for individual form elements, developers define a form through an array that instructs Drupal on how to assemble the form and present it to users. The Forms API also tells Drupal how to validate form submissions and what to do with any data being received.

The real power of the API, however, lies in the fact that custom modules can modify forms as they are being generated. Developers can create new fields, provide additional validation conditions, and handle form submissions dynamically. This kind of extensibility is unique to Drupal, and represents a very different pattern for designing web applications.

read more

آخر المشاركات

 

أوسمة الموقع