Commit c1f22034a143bec04534fb97bba478dc20aeef0a
1 parent
7ffab150
Added javascript to change main form action and submit
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@662 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
18 additions
and
6 deletions
lib/visualpatterns/PatternMainPage.inc
| ... | ... | @@ -73,8 +73,8 @@ class PatternMainPage { |
| 73 | 73 | $sToRender = "<html>\n" . |
| 74 | 74 | "<head>\n" . |
| 75 | 75 | "<meta http-equiv=\"refresh\" content=\"" . ($default->owl_timeout+3) . "\">\n" . |
| 76 | - "<link rel=\"StyleSheet\" HREF=\"$default->owl_ui_url/stylesheet.css\" type=\"text/css\">\n". | |
| 77 | - PatternMainPage::getNumberStringValidationJavaScript() . "\n" . | |
| 76 | + "<link rel=\"StyleSheet\" HREF=\"$default->owl_ui_url/stylesheet.css\" type=\"text/css\">\n". | |
| 77 | + PatternMainPage::getJavaScript() . "\n" . | |
| 78 | 78 | "</head>\n" . |
| 79 | 79 | "<body>\n" . |
| 80 | 80 | "<form name=\"MainForm\" " . (isset($this->sFormEncType) ? "enctype=\"$this->sFormEncType\" " : " ") . " action=\"".$this->sFormAction."\" method=\"POST\">\n" . |
| ... | ... | @@ -120,10 +120,16 @@ class PatternMainPage { |
| 120 | 120 | "</html>\n"; |
| 121 | 121 | echo $sToRender; |
| 122 | 122 | } |
| 123 | - | |
| 124 | - function getNumberStringValidationJavaScript() { | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * Returns java scrip that has 3 functions: | |
| 126 | + * o validateString - validates a string | |
| 127 | + * o validateNumber - validates a number | |
| 128 | + * o setActionAndSubmit - sets the MainForm action to newAction and submits | |
| 129 | + */ | |
| 130 | + function getJavaScript() { | |
| 125 | 131 | return "<script language=\"JavaScript\">\n". |
| 126 | - "<!--\n" . | |
| 132 | + "<!--\n" . | |
| 127 | 133 | "function validateString(field, msg, min, max) {\n" . |
| 128 | 134 | "\tif (!min) { min = 1 }\n" . |
| 129 | 135 | "\tif (!max) { max = 65535 }\n\n" . |
| ... | ... | @@ -148,11 +154,17 @@ class PatternMainPage { |
| 148 | 154 | "\t\treturn false;\n" . |
| 149 | 155 | "\t}\n" . |
| 150 | 156 | "\treturn true;\n" . |
| 151 | - "}\n" . | |
| 157 | + "}\n\n" . | |
| 158 | + | |
| 159 | + "function setActionAndSubmit(newAction) {\n ". | |
| 160 | + "\tdocument.MainForm.action = newAction;\n" . | |
| 161 | + "\tdocument.MainForm.submit();\n" . | |
| 162 | + "}\n" . | |
| 152 | 163 | "//-->\n" . |
| 153 | 164 | "</script>\n"; |
| 154 | 165 | } |
| 155 | 166 | |
| 167 | + | |
| 156 | 168 | } |
| 157 | 169 | |
| 158 | 170 | ?> |
| 159 | 171 | \ No newline at end of file | ... | ... |