Discussion:
svn: /pear/pearweb/trunk/ include/HTML/QuickForm2/Element/InputNumber.php public_html/account-mail.php
Daniel O'Connor
2011-04-13 00:29:31 UTC
Permalink
clockwerx Wed, 13 Apr 2011 00:29:31 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=310175

Log:
Fix position of captcha

Changed paths:
A pear/pearweb/trunk/include/HTML/QuickForm2/Element/InputNumber.php
U pear/pearweb/trunk/public_html/account-mail.php

Added: pear/pearweb/trunk/include/HTML/QuickForm2/Element/InputNumber.php
===================================================================
--- pear/pearweb/trunk/include/HTML/QuickForm2/Element/InputNumber.php (rev 0)
+++ pear/pearweb/trunk/include/HTML/QuickForm2/Element/InputNumber.php 2011-04-13 00:29:31 UTC (rev 310175)
@@ -0,0 +1,11 @@
+<?php
+require_once 'HTML/QuickForm2/Element/Input.php';
+
+if (!class_exists('HTML_QuickForm2_Element_InputNumber')) {
+ class HTML_QuickForm2_Element_InputNumber extends HTML_QuickForm2_Element_Input
+ {
+ protected $attributes = array('type' => 'number');
+ }
+
+ HTML_QuickForm2_Factory::registerElement('number', 'HTML_QuickForm2_Element_InputNumber');
+}

Modified: pear/pearweb/trunk/public_html/account-mail.php
===================================================================
--- pear/pearweb/trunk/public_html/account-mail.php 2011-04-13 00:25:48 UTC (rev 310174)
+++ pear/pearweb/trunk/public_html/account-mail.php 2011-04-13 00:29:31 UTC (rev 310175)
@@ -37,7 +37,7 @@
require_once 'HTML/QuickForm2.php';
/** @todo Remove once these become available in QF2 */
require_once 'HTML/QuickForm2/Element/InputEmail.php';
-
+require_once 'HTML/QuickForm2/Element/InputNumber.php';
require_once 'Text/CAPTCHA/Numeral.php';

$stripped = @array_map('strip_tags', $_POST);
@@ -72,14 +72,15 @@
$form->addElement('checkbox', 'copy_me')->setLabel('CC me?:');
$form->addElement('text', 'subject', array('required' => 'required', 'size' => '80'))->setLabel('Subject:');
$form->addElement('textarea', 'text', array('cols' => 80, 'rows' => 10, 'required' => 'required'))->setLabel('Text:');
- $form->addElement('submit', 'submit')->setLabel('Send Email');

if (!auth_check('pear.dev')) {
$numeralCaptcha = new Text_CAPTCHA_Numeral();
- $form->addElement('text', 'captcha', array('maxlength' => 4, 'required' => 'required'))->setLabel("What is " . $numeralCaptcha->getOperation() . ' = ');
+ $form->addElement('number', 'captcha', array('maxlength' => 4, 'required' => 'required'))->setLabel("What is " . $numeralCaptcha->getOperation() . '?');
$_SESSION['answer'] = $numeralCaptcha->getAnswer();
}

+ $form->addElement('submit', 'submit')->setLabel('Send Email');
+
print $form;
}

Loading...