/**
  * FormHandler::captchaField()
  *
  * Creates a captchafield on the form using Securimage - A PHP class for creating and managing form CAPTCHA images
  *
  * @param string $title: The title of the field
  * @param string $name: The name of the field
  * @param int $size: The size of the field
  * @param int $maxlength: The allowed max input of the field
  * @param string $extra: CSS, Javascript or other which are inserted into the HTML tag
  * @return void
  * @author Johan Wiegel
  * @since 27-11-2007
  * @deprecated Use \FormHandler\Field\Captcha::set() instead
  */
 public function CaptchaField($title, $name, $width = null, $height = null, $length = null, $size = null, $maxlength = null, $extra = null, $url = null)
 {
     \FormHandler\Field\Captcha::set($this, $title, $name)->setWidth($width)->setHeight(is_null($height) ? $length : $height)->setSize($size)->setMaxlength($maxlength)->setExtra($extra);
     return $this;
 }
Пример #2
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301  USA
 *
 * @author Marien den Besten
 */
session_start();
include '../src/Loader.php';
use FormHandler\FormHandler;
use FormHandler\Field;
use FormHandler\Button;
use FormHandler\Validator;
\FormHandler\Configuration::set('fhtml_dir', '../src/FHTML/');
//create a new FormHandler object
$form = new FormHandler();
$form->addLine('Fill captcha', true);
Field\Captcha::set($form, 'Required captcha', 'captcha');
$form->onCorrect(function ($data) {
    echo 'Captcha field working!';
});
Button\Submit::set($form);
//process all form results, needs to be done before any output has been done
$form_html = $form->flush();
//below is code to show the form
echo 'Test captcha field<hr>';
echo $form_html;