Marmot Manual

III. The MU_Form Class

Introduction

The MU_Form class provides end-to-end services for creating a form, validating a form's contents, and harvesting a form's data.

Properties

Read/write properties

These properties can be set by the developer after instantiating an MU_Form object.

  • title - The title of the form, often displayed at the top of the form.

  • instructions - a block of instructions, often displayed beneath the title.

  • form_error - text to display if the form validation fails

Read-only properties

These properties are set by the MU_Form class after form submission and/or validation.

  • validated - TRUE if the form was validated, FALSE otherwise

  • user_action - contains the name of the action that caused form submission. These actions are defined by the MU_Form::add_user_action() method.

    Note: user_action will contain the name of the action even if form validation failed. Always test both user_action and validated before acting on form input.

Table of Contents

MU_Form::MU_Form - constructor
MU_Form::add_hidden - Add a hidden element to an MU_Form object
MU_Form::add_section - Add a section to an MU_Form object
MU_Form::add_user_action - Add a submit button to an MU_Form object
MU_Form::reset - Reset a form
MU_Form::value - Retrieve a value from a submitted form
MU_Form::values - Retrieve all submitted values from a form