Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to automatically select uploaded files... #63

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

flekschas
Copy link

...when they have been uploaded using the + Add button next to the Selector field's label.

I extended the JS code to listen to changes of the file input field once when autoselectadd is set to true. The JS code basically parses out the name of the files to be uploaded and manipulates the value of the hidden $storage field. The final step is to programmatically submit the nearest html form such that the selection is saved. I've tested it with Kirby v2.5.2 and it works fine for single and multi Selector fields.

The biggest chunk was extracted from Kirby itself, namely the file name sanitizing function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant