|
new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::REQUIRED, 'string', FILTER_FLAG_STRIP_HIGH ),
'test2' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 42 ) ),
'test3' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 42 ) ),
);
$form = new ezcInputForm( INPUT_POST, $def );
echo "Valid properties:\n";
var_dump( $form->getValidProperties() );
echo "Invalid properties:\n";
var_dump( $form->getInvalidProperties() );
echo "Required properties:\n";
var_dump( $form->getRequiredProperties() );
echo "Optional properties:\n";
var_dump( $form->getOptionalProperties() );
echo "Values:\n";
var_dump( $form->hasValidData( 'test1' ) );
var_dump( $form->test1 );
try
{
var_dump( $form->getUnsafeRawData( 'test1' ) );
}
catch ( ezcInputFormException $e )
{
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
echo " \n";
var_dump( $form->hasValidData( 'test2' ) );
try
{
var_dump( $form->test2 );
}
catch ( ezcInputFormException $e )
{
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
try
{
var_dump( $form->getUnsafeRawData( 'test2' ) );
}
catch ( ezcInputFormException $e )
{
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
echo " \n";
var_dump( $form->hasValidData( 'test3' ) );
try
{
var_dump( $form->test3 );
}
catch ( ezcInputFormException $e )
{
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
try
{
var_dump( $form->getUnsafeRawData( 'test3' ) );
}
catch ( ezcInputFormException $e )
{
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
echo " \n";
var_dump( $form->hasValidData( 'test4' ) );
try
{
var_dump( $form->test4 );
}
catch ( ezcInputFormException $e )
{
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
try
{
var_dump( $form->getUnsafeRawData( 'test4' ) );
}
catch ( ezcInputFormException $e )
{
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
?>
|