Form: Process request parameter _frameUpload
This parameter is being used to flag a request as form submission issued by utilizing an iframe. Appending it to a form's action causes no redirection to take place in case of successful submission and a reduced but still valid layout to be printed in any way. Redirection must be handled by the client regarding the meta tag "redirectUrl". refs #8758
This commit is contained in:
parent
0a9a066749
commit
fc481e527b
|
@ -0,0 +1,10 @@
|
|||
<html>
|
||||
<head>
|
||||
<?php if (isset($this->layout()->redirectUrl)): ?>
|
||||
<meta name="redirectUrl" content="<?= $this->layout()->redirectUrl; ?>">
|
||||
<?php endif ?>
|
||||
</head>
|
||||
<body>
|
||||
<?= $this->render('inline.phtml'); ?>
|
||||
</body>
|
||||
</html>
|
|
@ -946,12 +946,20 @@ class Form extends Zend_Form
|
|||
|
||||
$formData = $this->getRequestData();
|
||||
if ($this->getUidDisabled() || $this->wasSent($formData)) {
|
||||
if (($frameUpload = (bool) $request->getUrl()->shift('_frameUpload', false))) {
|
||||
$this->getView()->layout()->setLayout('wrapped');
|
||||
}
|
||||
|
||||
$this->populate($formData); // Necessary to get isSubmitted() to work
|
||||
if (! $this->getSubmitLabel() || $this->isSubmitted()) {
|
||||
if ($this->isValid($formData)
|
||||
&& (($this->onSuccess !== null && false !== call_user_func($this->onSuccess, $this))
|
||||
|| ($this->onSuccess === null && false !== $this->onSuccess()))) {
|
||||
$this->getResponse()->redirectAndExit($this->getRedirectUrl());
|
||||
if (! $frameUpload) {
|
||||
$this->getResponse()->redirectAndExit($this->getRedirectUrl());
|
||||
}
|
||||
|
||||
$this->getView()->layout()->redirectUrl = $this->getRedirectUrl();
|
||||
}
|
||||
} elseif ($this->getValidatePartial()) {
|
||||
// The form can't be processed but we may want to show validation errors though
|
||||
|
|
Loading…
Reference in New Issue