Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php |
— | — | @@ -403,8 +403,6 @@ |
404 | 404 | $values = SFUtils::getAutocompleteValues($autocompletion_source, $autocomplete_field_type ); |
405 | 405 | $autocompletion_source = str_replace( "'", "\'", $autocompletion_source ); |
406 | 406 | |
407 | | - /*adding code for displaying dropdown of autocomplete values*/ |
408 | | - |
409 | 407 | $divClass = "ui-widget"; |
410 | 408 | if ($is_mandatory) { $divClass .= " mandatory"; } |
411 | 409 | $text =<<<END |
— | — | @@ -447,7 +445,7 @@ |
448 | 446 | return SFDropdownInput::getText( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ); |
449 | 447 | |
450 | 448 | global $sfgTabIndex, $sfgFieldNum, $sfgScriptPath, $wgJsMimeType, $smwgScriptPath, $smwgJqUIAutoIncluded; |
451 | | - global $sfgAutocompleteDataTypes, $sfgAutocompleteValues; |
| 449 | + global $sfgAutocompleteValues; |
452 | 450 | |
453 | 451 | $className = ( $is_mandatory ) ? "autocompleteInput mandatoryField" : "autocompleteInput createboxInput"; |
454 | 452 | if ( array_key_exists( 'class', $other_args ) ) |
— | — | @@ -462,7 +460,7 @@ |
463 | 461 | } |
464 | 462 | $input_id = "input_" . $sfgFieldNum; |
465 | 463 | |
466 | | - // Set autocomplete-settings attribute, and delimiter value (it's needed |
| 464 | + // Get all autocomplete-related values, plus delimiter value (it's needed |
467 | 465 | // also for the 'uploadable' link, if there is one). |
468 | 466 | $autocompleteSettings = $autocompletion_source; |
469 | 467 | $is_list = ( array_key_exists( 'is_list', $other_args ) && $other_args['is_list'] == true ); |
— | — | @@ -477,6 +475,16 @@ |
478 | 476 | } else { |
479 | 477 | $delimiter = null; |
480 | 478 | } |
| 479 | + |
| 480 | + $remoteDataType = null; |
| 481 | + if ( array_key_exists( 'remote autocompletion', $other_args ) && |
| 482 | + $other_args['remote autocompletion'] == true ) { |
| 483 | + $remoteDataType = $autocomplete_field_type; |
| 484 | + } elseif ( $autocompletion_source != '' ) { |
| 485 | + $autocomplete_values = SFUtils::getAutocompleteValues( $autocompletion_source, $autocomplete_field_type ); |
| 486 | + $sfgAutocompleteValues[$autocompleteSettings] = $autocomplete_values; |
| 487 | + } |
| 488 | + |
481 | 489 | if ( array_key_exists( 'input_type', $other_args ) && $other_args['input_type'] == "textarea" ) { |
482 | 490 | |
483 | 491 | $rows = $other_args['rows']; |
— | — | @@ -495,6 +503,9 @@ |
496 | 504 | 'class' => $className, |
497 | 505 | 'autocompletesettings' => $autocompleteSettings, |
498 | 506 | ); |
| 507 | + if ( !is_null( $remoteDataType ) ) { |
| 508 | + $textarea_attrs['autocompletedatatype'] = $remoteDataType; |
| 509 | + } |
499 | 510 | if ( $is_disabled ) { |
500 | 511 | $textarea_attrs['disabled'] = 'disabled'; |
501 | 512 | } |
— | — | @@ -528,6 +539,9 @@ |
529 | 540 | 'tabindex' => $sfgTabIndex, |
530 | 541 | 'autocompletesettings' => $autocompleteSettings, |
531 | 542 | ); |
| 543 | + if ( !is_null( $remoteDataType ) ) { |
| 544 | + $inputAttrs['autocompletedatatype'] = $remoteDataType; |
| 545 | + } |
532 | 546 | if ( $is_disabled ) { |
533 | 547 | $inputAttrs['disabled'] = 'disabled'; |
534 | 548 | } |
— | — | @@ -549,13 +563,6 @@ |
550 | 564 | if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
551 | 565 | $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
552 | 566 | |
553 | | - if ( array_key_exists( 'remote autocompletion', $other_args ) && |
554 | | - $other_args['remote autocompletion'] == true ) { |
555 | | - $sfgAutocompleteDataTypes[$autocompleteSettings] = $autocomplete_field_type; |
556 | | - } elseif ( $autocompletion_source != '' ) { |
557 | | - $autocomplete_values = SFUtils::getAutocompleteValues( $autocompletion_source, $autocomplete_field_type ); |
558 | | - $sfgAutocompleteValues[$autocompleteSettings] = $autocomplete_values; |
559 | | - } |
560 | 567 | return $text; |
561 | 568 | } |
562 | 569 | |