Hello,
Since IPS 4.7.6 upgrade, the input type text form field with autocomplete function doesn't work anymore with freeChoice option set to false.
Here is the function that extends formElements in my plugin:
static public function formElements($item = NULL, \IPS\Node\Model $container = NULL)
{
[...]
$wpPostField = new \IPS\Helpers\Form\Text(
'wp_post',
$wpPostFieldValue,
false,
[
'autocomplete' => [
'source' => $wpPostTitles,
'freeChoice' => false,
'maxItems' => 1,
'minItems' => 1,
'unique' => true,
'forceLower' => false,
'prefix' => false,
'minimized' => false,
'desc' => \IPS\Settings::i()->lttwpp_wp_post_field_description
],
'placeholder' => \IPS\Settings::i()->lttwpp_wp_post_field_placeholder
],
function ($value) use ($wpPostTitles) {
if (!empty($value) && !\in_array($value, $wpPostTitles)) {
throw new \DomainException('The selected WP post does not exist.');
}
},
null,
null,
'wp_post'
);
Here is the error:
When I set freeChoise parameter to true, it's working but it's not what I want.
Can you help me?
Thanks!