Commit 405ee3899d5c5ed1423143a5211e2c44474c4e44
1 parent
185a355a
added support for default values and cleaned up
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1664 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
6 additions
and
15 deletions
lib/visualpatterns/PatternCreate.inc
| ... | ... | @@ -22,7 +22,7 @@ class PatternCreate { |
| 22 | 22 | var $aDropDownListValueColumns; |
| 23 | 23 | var $aDropDownListDisplayColumns; |
| 24 | 24 | var $sUniqueName; |
| 25 | - | |
| 25 | + var $aDefaultValues; | |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Default constructor |
| ... | ... | @@ -53,6 +53,10 @@ class PatternCreate { |
| 53 | 53 | function setUniqueName($sNewValue) { |
| 54 | 54 | $this->sUniqueName = $sNewValue; |
| 55 | 55 | } |
| 56 | + | |
| 57 | + function setDefaultValues($aNewValue) { | |
| 58 | + $this->aDefaultValues = $aNewValue; | |
| 59 | + } | |
| 56 | 60 | |
| 57 | 61 | function render() { |
| 58 | 62 | $sToRender = "<table border=\"0\">\n"; |
| ... | ... | @@ -71,12 +75,7 @@ class PatternCreate { |
| 71 | 75 | //write the type (in this case text) |
| 72 | 76 | $sToRender .= "<input type=\"hidden\" name=\"" . $this->sUniqueName . "_" . $i . "_type\" value=\"1\" />\n"; |
| 73 | 77 | //write the value |
| 74 | - /*if ($this->aRequired[$i]) { | |
| 75 | - $sToRender .= "<td>" . $this->aDisplayRowNames[$i] . "</td><td><input type=\"text\" name=" . $this->sUniqueName . "_" . $i . "_value value=\"\" onfocus=\"validRequired(" . $this->sUniqueName . "_" . $i . "_value, '" . $this->aDisplayRowNames[$i] . "')\" /></td>\n"; | |
| 76 | - } else { | |
| 77 | - $sToRender .= "<td>" . $this->aDisplayRowNames[$i] . "</td><td><input type=\"text\" name=\"" . $this->sUniqueName . "_" . $i . "_value value=\"\" /></td>\n"; | |
| 78 | - }*/ | |
| 79 | - $sToRender .= "<td>" . $this->aDisplayRowNames[$i] . "</td><td><input size = \"30\" type=\"text\" name=\"" . $this->sUniqueName . "_" . $i . "_value\" value=\"\" /></td>\n"; | |
| 78 | + $sToRender .= "<td>" . $this->aDisplayRowNames[$i] . "</td><td><input size = \"30\" type=\"text\" name=\"" . $this->sUniqueName . "_" . $i . "_value\" value=\"" . (isset($this->aDefaultValues[$i]) ? $this->aDefaultValues[$i] : "") . "\" /></td>\n"; | |
| 80 | 79 | break; |
| 81 | 80 | case 2: |
| 82 | 81 | //write the type (in this case checkbox) |
| ... | ... | @@ -117,7 +116,6 @@ class PatternCreate { |
| 117 | 116 | $sToRender .= $this->generateRequiredFieldValidation(); |
| 118 | 117 | |
| 119 | 118 | return $sToRender; |
| 120 | - | |
| 121 | 119 | } |
| 122 | 120 | |
| 123 | 121 | function generateRequiredFieldValidation() { |
| ... | ... | @@ -127,19 +125,12 @@ class PatternCreate { |
| 127 | 125 | if ($this->aRequired[$i]) { |
| 128 | 126 | $sToRender .= "\tif (!(validRequired(document.MainForm." . $this->sUniqueName . "_" . $i . "_value, '" . $this->aDisplayRowNames[$i] . "'))) {\n"; |
| 129 | 127 | $sToRender .= "\t\treturn false;\n\t}\n"; |
| 130 | - //$sToRender .= "alert(\"You dumbass\");\n"; | |
| 131 | - //$sToRender .= "alert(theForm." . $this->sUniqueName . "_" . $i . "_value);\n"; | |
| 132 | - //$sToRender .= "validRequired(theForm." . $this->sUniqueName . "_" . $i . "_value, '" . $this->aDisplayRowNames[$i] . "');\n"; | |
| 133 | - | |
| 134 | 128 | } |
| 135 | 129 | } |
| 136 | 130 | $sToRender .= "return true;\n}\n"; |
| 137 | - | |
| 138 | 131 | $sToRender .= "//-->\n</script>\n\n"; |
| 139 | 132 | |
| 140 | 133 | return $sToRender; |
| 141 | - | |
| 142 | 134 | } |
| 143 | 135 | } |
| 144 | - | |
| 145 | 136 | ?> | ... | ... |