Using with date_popup Form API element

Pop-up calendar widget for Date fields is not the only thing provided by the Date Popup module. It actually defines new form element first and then uses it when defines Pop-up calendar widget.

Comparison of Form Building Modules

Drupal has a lot of modules aimed at helping site builders and users add forms to their sites. What follows is a rough comparison of three of them for Drupal 8 and five of them for Drupal 7. Please add any missed or new information about the ones listed.

Using form_alter to change the default value of a date

If you need to set a default value for an exposed views filter, you can do it like this:

this example code will set a ranged date to have a default value of -30 days for the start date, and today for the end date

Multi-step forms

<< mforms project page

Installation and configuration

Mforms is a library, so by itself it does not provide any functionality (besides the real-life examples in the mforms example module). Therefore there is no configuration or installation besides enabling the module in the module list.

Basic usage

Included module mforms_example contains several real life examples that are documented in code. To find out what it does visit /mforms page after you enable mforms_example module.

Mforms architecture

For faster dive into mforms here is the basic architecture:

Prerequisites

STORE_KEY - not just identifies the storage slot for submitted values, it represents the identifier of whole multi-step form implementation.

Steps file - The file where individual form steps with their validate and submit callbacks reside. See mforms_example/mforms/mforms_example.session_store_example.inc for demonstration. This file must be named in the following pattern: MODULE_NAME.STORE_KEY.inc and placed in "mforms" directory of the module in which you are implementing the multi step form.

Store object - MformsIstore implementation responsible for storing submitted values and internal mforms data needed to control the stepping process.

Drupal 6 Form API Quickstart Guide

Note that these instructions focus on Drupal 6. Corresponding documentation for Drupal 7 is here.

The Drupal Form API provides sophisticated form techniques and also allows for almost unlimited possibilities for custom theming, validation, and execution of forms. Even better, ANY form (even those in core) can be altered in almost any way imaginable—elements can be removed, added, and rearranged.

Pages

Subscribe with RSS Subscribe to RSS - form api