What is Disco?
Disco is Carleton’s open source form utility class. Using Disco, a programmer can quickly create a functional form with a variety of elements, and perform a task upon user submission. Disco is commonly used by extending the base class with logic appropriate for the desired form.
The following provides a simple example:
class MyForm extends Disco { var $elements = array(‘your_name’ => ‘tinytext’, ‘age’ => ‘tinytext’); var $required = array(‘age’); function run_error_checks() { $age = $this->get_value(‘age’); if (!is_numeric($age)) { $this->set_error(‘age’, ‘You must enter your age using only valid digits’); } elseif ($age < 30) { $this->set_error(‘age’, ‘Sorry, you are too long to use this form’); } } function process() { echo ‘You are ‘ . $this->get_value(‘age’) . ‘ years old! Wow.’; } } $my_form = new MyForm(); $my_form->run();
- What is Disco?
- What is Thor?
- What is Tyr?
- Blog