https://github.com/hounddd/wn-selfcomplete-plugin
A "text" formwidget which, like a "dropdown" field, offers options based on existing DB values.
https://github.com/hounddd/wn-selfcomplete-plugin
autocomplete formwidget plugin wintercms
Last synced: 18 days ago
JSON representation
A "text" formwidget which, like a "dropdown" field, offers options based on existing DB values.
- Host: GitHub
- URL: https://github.com/hounddd/wn-selfcomplete-plugin
- Owner: Hounddd
- License: mit
- Created: 2021-05-04T16:46:11.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-10T14:18:41.000Z (almost 2 years ago)
- Last Synced: 2025-03-29T10:43:47.576Z (about 1 month ago)
- Topics: autocomplete, formwidget, plugin, wintercms
- Language: JavaScript
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Self complete formwidget
A "text" formwidget which, like a "dropdown" field, offers options based on existing DB values.

## Why this formwidget
Simple **text** fields let only enter new values, while **dropdown** ones let only select between values.
This field will act as a text entry letting you enter any value consistent with the field, but at the same time will provide you with the previous unique values for that same field.
In this way it is possible to see the values already present in the database and to avoid duplicates due to different entries by different users.
**It is still possible to enter whatever you want in the field.**## How to use
The plugin register a new form field type : `selfcomplete`.
You can use it in your [backend fields definition](https://wintercms.com/docs/backend/forms#form-fields).```
city:
label: City SelfComplete
type: selfcomplete
modelClass: \Winter\Test\Models\City
# table: 'winter_test_cities'
selectFrom: name
```
### Options
None of these are required, if omited the form widget will use the current controller class and field name.
- **modelClass**: Model class name to use.
- **table**: Table name to use.
- **selectFrom**: Field name to use.*Be careful when using it, this form widget has not been tested with other than text fields.*