alleyinteractive / alleyinteractive/wordpress-fieldmanager

Clear input value on Fieldmanager_Autocomplete

Aperta
#878 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
PHP
Stelle
563
Fork
99
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Description

Hi,

As far as I know, we don't have a way to prevent the user from selecting duplicate Posts when we use Fieldmanager_Autocomplete -> Fieldmanager_Datasource_Post.

I'm using a custom JS code where based on some rules, I apply this:

```
$(this).val('');
$(this).trigger('input').trigger('change');
$(this).blur().focus();
alert( 'This post is already selected. Please choose a different one.' );
```

That works fine (kind of). The input value is set to empty, even if the user saves any changes, duplicate records are no longer saved. However, even when the input value is empty, the title of the Post remains visible in the input.

Do we have a way to clear that Post Title from the input as well? or a way to trigger the remove record action?

![Screenshot 2024-09-11 at 5 19 15 PM](https://github.com/user-attachments/assets/fc8fa501-d88c-409a-b382-539afeec7939)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.