Source for file EMailTextInput.class.php
Documentation is available at EMailTextInput.class.php
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
echo "<h3>You have to define the constant CLASSPATH!</h3>\r\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\r\n";
* Including language specific messages.
include CLASSPATH. "/forms/items/EMailTextInput/". LANG. ".inc.php";
echo "<h3>You have to define the constant LANG!</h3>\n";
echo "Example for german: define( 'LANG', 'de' );\n";
require_once CLASSPATH. "forms/items/HTMLTextInput.class.php";
include_once CLASSPATH. "RegExpConstants.inc.php";
* A class to generate text input fields for email-input.
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (C) 2003 Daniel Plücken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* @author Daniel Plücken <daniel@debakel.net>
* @param integer $maxchar*
parent::setOnBlur( "checkEmail( this );" );
* Stores the value of this item's "onBlur"-attribute.
* @author Daniel Plücken <daniel@debakel.net>
{ parent::setOnBlur( "checkEmail( this );". $string ); }
* Returns a javascript to probe if the value, that was typed in the
* textfield, is an email.
* @author Daniel Plücken <daniel@debakel.net>
if ( empty( $JSTOCHECKEMAIL ) )
$out = "\r\n\r\n<script language=\"javascript\">\r\n";
$out .= " window.checkEmail = function( which )\r\n";
$out .= " string = which.value;\r\n\r\n";
$out .= " if( string == \"\" )\r\n";
$out .= " return true;\r\n";
$out .= " pattern = /^[-a-zA-Z0-9_.]+@"
. "(([-a-zA-Z0-9]+\\.)+" // domain
. "|\[?([0-9]{1,3}\.){3,3}" // ip
. "[0-9]{1,3}\]?)$/;\r\n";
$out .= " if( pattern.test( string ) )\r\n";
$out .= " return true;\r\n";
$out .= " alert( unescape( \"". JS_ERR_MSG. "\" ) );\r\n";
$out .= " which.focus();\r\n";
$out .= " return false;\r\n";
$out .= "</script>\r\n\r\n\r\n";
* Returns an if-order of a javascript to check whether the value of this
* item has the correct format.
* @author Daniel Plücken <daniel@debakel.net>
$out = "checkEmail( document."
* Generates the sourcecode to build this object and returns it.
* @author Daniel Plücken <daniel@debakel.net>
$out = "unset( \x24value );\r\n";
$out .= "\x24value = \x24_POST[\"". $this->getName(). "\"]\r\n"
. " .\x24_GET[\"". $this->getName(). "\"];\r\n";
$out .= "\x24input[] = new EMailTextInput(\r\n"
? "if( \x24value === \"\" )\r\n"
. " \x24input[count(\x24input)-1]"
. "->setValue( \"". $tmp. "\" );\r\n\r\n"
* Returns a generated string based on the attributes of this object.
* @author Daniel Plücken <daniel@debakel.net>
function get( $type = "" )
$out .= parent::get( $type );
} // ENDE class EMailTextInput
|