Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'hotfix/2711' into develop

Forward port #2711
  • Loading branch information...
commit 7980d0e2152277f9d6f44d04a3db23c697ac687a 2 parents cfb5318 + 994f44f
@weierophinney weierophinney authored
Showing with 31 additions and 14 deletions.
  1. +31 −14 demos/Zend/ProgressBar/ZendForm.php
View
45 demos/Zend/ProgressBar/ZendForm.php
@@ -10,6 +10,8 @@
use Zend\File\Transfer\Adapter\Http;
use Zend\Form\Form;
+use Zend\Form\Element;
+use Zend\Form\View\Helper;
use Zend\Loader\StandardAutoloader;
use Zend\ProgressBar\Adapter\JsPull;
@@ -109,7 +111,7 @@ function makeRequest(url)
if (httpRequest.overrideMimeType) {
httpRequest.overrideMimeType('text/xml');
}
- } elseif (window.ActiveXObject) {
+ } else if (window.ActiveXObject) {
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
@@ -184,21 +186,36 @@ function finish()
</head>
<body>
<?php
-$form = new Form(
- array(
- 'enctype' => 'multipart/form-data',
- 'action' => 'ZendForm.php',
- 'target' => 'uploadTarget',
- 'onsubmit' => 'observeProgress();',
- 'elements' => array(
- 'file' => array('file', array('label' => 'File')),
- 'submit' => array('submit', array('label' => 'Upload!'))
- )
- )
-);
+$file = new Element\File('file');
+$file->setLabel('File');
+
+$progress_key = new Element\Hidden('progress_key');
+$progress_key->setAttribute('id', 'progress_key');
+$progress_key->setValue(md5(uniqid(rand())));
+
+$submit = new Element\Submit('submit');
+$submit->setValue('Upload!');
+
+$form = new Form("ZendForm");
+$form->setAttributes(array(
+ 'enctype' => 'multipart/form-data',
+ 'action' => 'ZendForm.php',
+ 'target' => 'uploadTarget',
+ 'onsubmit' => 'observeProgress();'
+));
+
$form->prepare();
-echo $form;
+$formhelper = new Helper\Form();
+$formfile = new Helper\FormFile();
+$formhidden = new Helper\FormHidden();
+$formsubmit = new Helper\FormSubmit();
+
+echo $formhelper->openTag($form);
+echo $formhidden($progress_key);
+echo $formfile($file);
+echo $formsubmit($submit);
+echo $formhelper->closeTag();
?>
<iframe name="uploadTarget"></iframe>
Please sign in to comment.
Something went wrong with that request. Please try again.