/** * Builds, validates and processes a form. * * Given a form definition, and as long as one or two functions are implemented * by the caller, this function will handle everything else. * * USAGE: * * <pre> * $form = array( * 'name' => 'myform', * 'method' => 'post', * 'elements' => array( * // definition of elements in the form * ) * ); * * $smarty->assign('myform', pieform($form)); * * function myform_validate(Pieform $form, $values) { * // perform validation agains form elements here * // some types of validation are conveniently available already as * // as part of the form definition hash * } * * function myform_submit(Pieform $form, $values) { * // perform action knowing that the values are valid, e.g. DB insert. * } * </pre> * * Please see http://pieforms.sourceforge.net/doc/html/ for * more information on creating and using forms. * */ function pieform($data) { /*{{{*/ return Pieform::process($data); }