diff options
author | Ermal <eri@pfsense.org> | 2010-03-11 23:41:38 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-03-11 23:41:38 +0000 |
commit | 2465ff5b5d6558e6a8664e1334edace6bf3aa5de (patch) | |
tree | bc142932db0afac47e4f60aa35348983798da3d7 | |
parent | df2beeb1583fd0bcc67ec54922804bd217673693 (diff) | |
download | pfsense-2465ff5b5d6558e6a8664e1334edace6bf3aa5de.zip pfsense-2465ff5b5d6558e6a8664e1334edace6bf3aa5de.tar.gz |
Add a function that allows to show/hide fields. Also correct the enable/disable function.
-rwxr-xr-x | usr/local/www/wizard.php | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 5991c66..b81a3d0 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -186,8 +186,8 @@ include("head.inc"); function FieldValidate(userinput, regexp, message) { - if(!userinput.match(regexp)) - alert(message); + if(!userinput.match(regexp)) + alert(message); } function enablechange() { @@ -211,12 +211,14 @@ function enablechange() { } print "\t" . '} else {' . "\n"; if(isset($field['enablefields'])) { + $enablefields = explode(',', $field['enablefields']); foreach($enablefields as $enablefield) { $enablefield = strtolower($enablefield); print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n"; } } if(isset($field['checkenablefields'])) { + $checkenablefields = explode(',', $field['checkenablefields']); foreach($checkenablefields as $checkenablefield) { $checkenablefield = strtolower($checkenablefield); print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n"; @@ -227,6 +229,46 @@ function enablechange() { } ?> } + +function showchange() { +<?php + foreach($pkg['step'][$stepid]['fields']['field'] as $field) { + if(isset($field['showfields']) or isset($field['checkshowfields'])) { + print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked == false) {' . "\n"; + if(isset($field['showfields'])) { + $showfields = explode(',', $field['showfields']); + foreach($showfields as $showfield) { + $showfield = strtolower($showfield); + print "\t\t" . 'document.iform.' . $showfield . '.display =\"none\";' . "\n"; + } + } + if(isset($field['checkshowfields'])) { + $checkshowfields = explode(',', $field['checkshowfields']); + foreach($checkshowfields as $checkshowfield) { + $checkshowfield = strtolower($checkshowfield); + print "\t\t" . 'document.iform.' . $checkshowfield . '.display = \"none\";' . "\n"; + } + } + print "\t" . '} else {' . "\n"; + if(isset($field['showfields'])) { + $showfields = explode(',', $field['showfields']); + foreach($showfields as $showfield) { + $showfield = strtolower($showfield); + print "\t\t" . 'document.iform.' . $showfield . '.display =\"\";' . "\n"; + } + } + if(isset($field['checkenablefields'])) { + $checkshowfields = explode(',', $field['checkshowfields']); + foreach($checkshowfields as $checkshowfield) { + $checkshowfield = strtolower($checkshowfield); + print "\t\t" . 'document.iform.' . $checkshowfield . '.display =\"\";' . "\n"; + } + } + print "\t" . '}' . "\n"; + } + } +?> +} //--> </script> <?php } ?> |