diff options
author | Phil Davis <phil.davis@inf.org> | 2015-07-13 10:53:03 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-07-13 10:53:03 +0545 |
commit | 5eabad3db3cd1f39596f2e682167e1ea2e81326e (patch) | |
tree | 8db96352c776c0e452a01a2a66ec13b1bdeeabe3 /usr/local/www/system_hasync.php | |
parent | fd29caa1c8bc3aa547c50e4842aecd7314cc8d89 (diff) | |
download | pfsense-5eabad3db3cd1f39596f2e682167e1ea2e81326e.zip pfsense-5eabad3db3cd1f39596f2e682167e1ea2e81326e.tar.gz |
Cancel button after input error
If there is an input error then the edit page is redrawn showing the
input errors. The HTTP_REFERER becomes the current page, rather than the
true original referer. Then if you click Cancel the current page is just
redrawn.
This change makes the code remember the original referer, so if the user
enters some invalid data, presses Save, reads the input error messages
then presses Cancel they are taken back out to the original page - the
same as if Cancel was used before Save.
Diffstat (limited to 'usr/local/www/system_hasync.php')
-rwxr-xr-x | usr/local/www/system_hasync.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/local/www/system_hasync.php b/usr/local/www/system_hasync.php index 1ce81e6..8ebde1f 100755 --- a/usr/local/www/system_hasync.php +++ b/usr/local/www/system_hasync.php @@ -42,7 +42,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_hasync.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_hasync.php'); +} if (!is_array($config['hasync'])) { $config['hasync'] = array(); @@ -347,6 +351,7 @@ include("head.inc"); <input name="id" type="hidden" value="0" /> <input name="Submit" type="submit" class="formbtn" value="Save" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> </td> </tr> </table> |