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

Update Dropzone "Max Files" dynamically #83

Open
darrenrhymer opened this issue May 10, 2021 · 1 comment
Open

Update Dropzone "Max Files" dynamically #83

darrenrhymer opened this issue May 10, 2021 · 1 comment

Comments

@darrenrhymer
Copy link

Hi

APEX OCI, 20.2

In my project I want to limit the user to uploading 6 images per product. On the page I have 3 hidden fields:

P1_DROPZONE_NO_IMAGES
select count(*) from my_table where id = :P1_ID

P1_DROPZONE_MAX_IMAGES
static =
6

P1_DROPZONE_FILE_COUNT
= :P1_DROPZONE_MAX_IMAGES - :P1_DROPZONE_NO_IMAGES

The DROPZONE attributes
max Files: &P1_DROPZONE_FILE_COUNT.

When I refresh the page and i have 4 images stored in db my values are :
P1_DROPZONE_NO_IMAGES = 4
P1_DROPZONE_MAX_IMAGES = 6
P1_DROPZONE_FILE_COUNT = 2

And i cannot load any more than 2 images using Dropzone. However when i upload one image my values are now:
P1_DROPZONE_NO_IMAGES = 5
P1_DROPZONE_MAX_IMAGES = 6
P1_DROPZONE_FILE_COUNT = 1

But I can still then add a further 2. The value of P1_DROPZONE_FILE_COUNT is 1 but the Max Files in Dropzone is still 2. I have tried refreshing the DropZone region.

How can I make sure Dropzone MaxFiles is updated correctly please?

Thanks

@darrenrhymer
Copy link
Author

In the DA execute a Javascript Code action:

$('.dropzone')[0].dropzone.options.maxFiles = $v("P1_DROPZONE_FILE_COUNT");

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

No branches or pull requests

1 participant