I am reporting another problem with the autocompletion. The problem was actually reported some time ago in the Page Forms talk page https://www.mediawiki.org/wiki/Extension_talk:Page_Forms/Archive_August_to_October_2016#Remote_autocomplete_and_mapping_property_don%27t_work_together. I have been taking a look at the code and I think I have a fix for the problem.
As said in the talk page topic, the problem occurs when using mappings (as documented in https://www.mediawiki.org/wiki/Extension:Page_Forms/Input_types#Mapping) with remote autocompletion.
For the case of the mapping with a template, the mapping works but remote autocompletion is always disabled and local autocompletion is used instead. However, for the other mappings (I tried the cargo one, although with SMW properties is the same as reported in the talk page) remote autocompletion may be enabled, but then the mapping is not being applied.
Looking through the code it seems that remote autocompletion should be disabled when using any mapping (as in the case of template mappings), but this is not currently done for cargo or SMW mappings. The following patch disables remote autocompletion for all mapping types and should solve the problem. Anyway, it would be nice to have remote autocompletion with mappings, maybe it could be added to the list of planned features.
diff --git a/includes/forminputs/PF_ComboBoxInput.php b/includes/forminputs/PF_ComboBoxInput.php index ea3b8744..a42aa507 100644 --- a/includes/forminputs/PF_ComboBoxInput.php +++ b/includes/forminputs/PF_ComboBoxInput.php @@ -153,7 +153,10 @@ class PFComboBoxInput extends PFFormInput { if ( count( $autocompleteValues ) > $wgPageFormsMaxLocalAutocompleteValues && $autocompleteFieldType != 'values' && !array_key_exists( 'values dependent on', $field_args ) && - !array_key_exists( 'mapping template', $field_args ) + !array_key_exists( 'mapping template', $field_args ) && + !array_key_exists( 'mapping property', $field_args ) && + !(array_key_exists( 'mapping cargo table', $field_args ) && + array_key_exists( 'mapping cargo field', $field_args )) ) { $remoteDataType = $autocompleteFieldType; } else { diff --git a/includes/forminputs/PF_TextWithAutocompleteInput.php b/includes/forminputs/PF_TextWithAutocompleteInput.php index a954fd18..071f428b 100644 --- a/includes/forminputs/PF_TextWithAutocompleteInput.php +++ b/includes/forminputs/PF_TextWithAutocompleteInput.php @@ -142,7 +142,12 @@ class PFTextWithAutocompleteInput extends PFTextInput { $autocompleteValues = PFValuesUtils::getAutocompleteValues( $autocompletionSource, $autocompleteFieldType ); } if ( count( $autocompleteValues ) > $wgPageFormsMaxLocalAutocompleteValues && - $autocompleteFieldType != 'values' && !array_key_exists( 'values dependent on', $field_args ) && !array_key_exists( 'mapping template', $field_args ) + $autocompleteFieldType != 'values' && + !array_key_exists( 'values dependent on', $field_args ) && + !array_key_exists( 'mapping template', $field_args ) && + !array_key_exists( 'mapping property', $field_args ) && + !(array_key_exists( 'mapping cargo table', $field_args ) && + array_key_exists( 'mapping cargo field', $field_args )) ) { $remoteDataType = $autocompleteFieldType; } else {