Re: HTML_OOH_Forms bug?
| From: | Georg Bez | Date: | Wed, 29 May 2002 09:30:28 +0000 |
| Subject: | Re: HTML_OOH_Forms bug? | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6580@lists.php.net to get a copy of this message | ||
this is my code.
sorry for my cross postings. i have problems with my email acount.
Georg
<?php
function upload_image_form ( $id = NULL )
{
global $dbc;
$f = new form ( "image2content" );
#$f = new form ();
$f->setDefaults( array ( "textsize" => 30 ) );
$f->setJSError("Errors...");
$f->CR_HTML = "\n\r";
$f->addElement( array ( 'type' => 'hidden', 'name' =>
'op', 'value' =>
'new' ) );
$f->addElement ( array ( 'type' => 'hidden', 'name' =>
'id', 'value'
=> $id ) );
$f->addElement(
array (
"name" => "image_file",
"type" => "fileupload",
"size" => 10,
"maxfilesize" => 100,
#"accept" => "text/html",
"minlength" => 1,
"length_e" => "Check",
"valid_regex" => "[gif|jpg|jpeg]$",
"valid_icase" => false,
"valid_e" => "Check"
)
);
#[...]
$f->addElement
(
array
(
'type' => 'submit', 'name' => 'b1',
'value' => 'Save'
)
);
if ( count($GLOBALS['HTTP_' . $f->getMethod(). '_VARS']) > 0 )
{
#form send
$f->autoloadValues();
list($error_msg, $error_flags) = $f->validate();
$submitted = true;
}
else
{
#first
$error_msg = '';
$error_flags = array();
$submitted = false;
}
if ( $error_msg || !$submitted )
{
// (int rows, int cols)
$grid = new gridlayout(7, 2);
grid->addContent( "<div align=\"right\">Image</div>" );
if (isset($error_flags['image_file2content']))
$grid->addContent( "<font size=\"-2\"
color=\"#FF0000\">".$error_flags['image_file2content']."<br></font>".$f-
>getElement('image_file2content') );
else
$grid->addContent( $f->getElement('image_file') );
#[...]
$grid->addContent( " " );
$grid->addContent( $f->getElement('b1') );
$content .= $f->getStart();
$content .= $f->getElement('op');
if ( $menu_id ) $content .= $f->getElement('menu_id');
$content .= "<div
class=\"error_block\">".$grid->get()."</div>";
$content .= $f->getFinish();
}
else
{
#all ok + send
}
return $content;
}
?>