| Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.inc |
| — | — | @@ -316,8 +316,17 @@ |
| 317 | 317 | if (array_key_exists('input_type', $other_args) && $other_args['input_type'] == "textarea") { |
| 318 | 318 | $rows = $other_args['rows']; |
| 319 | 319 | $cols = $other_args['cols']; |
| | 320 | + if (array_key_exists('maxlength', $other_args)) { |
| | 321 | + $maxlength = $other_args['maxlength']; |
| | 322 | + // is this an unnecessary performance load? Get the substring of the |
| | 323 | + // text on every key press or release, regardless of the current length |
| | 324 | + // of the text |
| | 325 | + $js_call = " onKeyDown=\"this.value = this.value.substring(0, $maxlength);\" onKeyUp=\"this.value = this.value.substring(0, $maxlength);\""; |
| | 326 | + } else { |
| | 327 | + $js_call = ""; |
| | 328 | + } |
| 320 | 329 | $text =<<<END |
| 321 | | - <textarea tabindex="$sfgTabIndex" id="$input_id" name="$input_name" rows="$rows" cols="$cols" class="$className" $disabled_text></textarea> |
| | 330 | + <textarea tabindex="$sfgTabIndex" id="$input_id" name="$input_name" rows="$rows" cols="$cols" class="$className" $disabled_text $js_call></textarea> |
| 322 | 331 | |
| 323 | 332 | END; |
| 324 | 333 | } else { |
| — | — | @@ -412,9 +421,18 @@ |
| 413 | 422 | |
| 414 | 423 | $rows = $other_args['rows']; |
| 415 | 424 | $cols = $other_args['cols']; |
| | 425 | + if (array_key_exists('maxlength', $other_args)) { |
| | 426 | + $maxlength = $other_args['maxlength']; |
| | 427 | + // is this an unnecessary performance load? Get the substring of the |
| | 428 | + // text on every key press or release, regardless of the current length |
| | 429 | + // of the text |
| | 430 | + $js_call = " onKeyDown=\"this.value = this.value.substring(0, $maxlength);\" onKeyUp=\"this.value = this.value.substring(0, $maxlength);\""; |
| | 431 | + } else { |
| | 432 | + $js_call = ""; |
| | 433 | + } |
| 416 | 434 | |
| 417 | 435 | $text =<<<END |
| 418 | | - <textarea tabindex="$sfgTabIndex" id="$input_id" name="$input_name" rows="$rows" cols="$cols" class="$className" $disabled_text>$cur_value</textarea> |
| | 436 | + <textarea tabindex="$sfgTabIndex" id="$input_id" name="$input_name" rows="$rows" cols="$cols" class="$className" $disabled_text $js_call>$cur_value</textarea> |
| 419 | 437 | <span id="$info_id" class="errorMessage"></span> |
| 420 | 438 | |
| 421 | 439 | END; |