diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-07-06 10:47:55 -0400 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-07-06 10:51:37 -0400 |
commit | 07451ca8cbf56e2aecd0e52559b48f3e09d8a6b0 (patch) | |
tree | 27a30019d6910bc69d950621740fc50b6974903c /src | |
parent | c55c20159db6e28af58911a358e29f605c0343a1 (diff) | |
download | pfsense-07451ca8cbf56e2aecd0e52559b48f3e09d8a6b0.zip pfsense-07451ca8cbf56e2aecd0e52559b48f3e09d8a6b0.tar.gz |
Fixed #6577 - Preserve user input on error
(cherry picked from commit a654d899cd5d288501fea1ec52dba2e3f0e479ba)
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/pkg_edit.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/usr/local/www/pkg_edit.php b/src/usr/local/www/pkg_edit.php index 20df922..118433d 100644 --- a/src/usr/local/www/pkg_edit.php +++ b/src/usr/local/www/pkg_edit.php @@ -1420,15 +1420,19 @@ foreach ($pkg['fields']['field'] as $pkga) { unset($value); $width = null; - if ($rowhelper['value'] != "") { - $value = $rowhelper['value']; - } $fieldname = $rowhelper['fieldname']; $fielddescr = $rowhelper['fielddescr']; - // if user is editing a record, load in the data. - if (isset($id) && $a_pkg[$id]) { +print($fieldname); print("<br />"); +print($_POST[$fieldname.$rowcounter]); print("<br />"); print("<br />"); + + // If input validation failed, read the value from the POST data so that hte user's input is not lost + if ($get_from_post && isset($_POST[$fieldname.$rowcounter])) { + $value = $_POST[$fieldname.$rowcounter]; + } elseif (isset($id) && $a_pkg[$id]) { $value = $row[$fieldname]; + }elseif ($rowhelper['value'] != "") { + $value = $rowhelper['value']; } $type = $rowhelper['type']; @@ -1437,7 +1441,7 @@ foreach ($pkg['fields']['field'] as $pkga) { $value = base64_decode($value); } } - $fieldname = $rowhelper['fieldname']; + if ($rowhelper['size']) { $size = $rowhelper['size']; |