Skip to content

Conversation

@mjauvin
Copy link
Member

@mjauvin mjauvin commented May 17, 2023

When in preview mode, if a dropdown field is used as another field's trigger, the trigger won't happen because the js code does not find the trigger field.

Fix #845

@mjauvin mjauvin added maintenance PRs that fix bugs, are translation changes or make only minor changes needs review Issues/PRs that require a review from a maintainer labels May 17, 2023
@mjauvin mjauvin added this to the v1.2.3 milestone May 17, 2023
@mjauvin mjauvin requested a review from LukeTowers May 17, 2023 11:46
@mjauvin mjauvin self-assigned this May 17, 2023
@LukeTowers LukeTowers modified the milestones: v1.2.3, v1.2.2 May 17, 2023
@LukeTowers LukeTowers added Status: Completed and removed needs review Issues/PRs that require a review from a maintainer labels May 17, 2023
@LukeTowers LukeTowers changed the title input element is needed in previewMode for trigger actions to work Support trigger actions for dropdown fields in preview mode May 17, 2023
@LukeTowers LukeTowers merged commit 7adf773 into develop May 17, 2023
@LukeTowers LukeTowers deleted the fix-dropdown-previewmode branch May 17, 2023 13:41
@bennothommo
Copy link
Member

I'm curious as to how this fixes the issue. AFAICT, no trigger attributes are being populated here and in some other field types when in preview mode, so there will be a disconnect between triggers in preview vs. create/update.

@mjauvin
Copy link
Member Author

mjauvin commented May 18, 2023

The trigger js code is searching for the trigger field and its value and couldn't find it without this hidden input element.

@mjauvin
Copy link
Member Author

mjauvin commented May 18, 2023

I'm curious as to how this fixes the issue. AFAICT, no trigger attributes are being populated here and in some other field types when in preview mode, so there will be a disconnect between triggers in preview vs. create/update.

Those trigger attributes you refer to are the element BEING triggered, not the trigger field itself.

@bennothommo
Copy link
Member

Alright, fair enough, this fixes dropdowns. But I'd say the issue will remain for other field types (ie. the text/email/number/etc. fields where the input is swapped with a span). So on face value, I don't think this entirely fixes the linked issue.

@mjauvin
Copy link
Member Author

mjauvin commented May 18, 2023

The trigger attributes are added to the field container, I think this is what you're looking for.

This is done in the field_container partial

@mjauvin
Copy link
Member Author

mjauvin commented May 18, 2023

Alright, fair enough, this fixes dropdowns. But I'd say the issue will remain for other field types (ie. the text/email/number/etc. fields where the input is swapped with a span). So on face value, I don't think this entirely fixes the linked issue.

I see your point though, if the trigger field was a text field, that would still be broken, most likely. I'll revisit this for the other field types as well. But dropdown and switch/checkboxes are the most common trigger field types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance PRs that fix bugs, are translation changes or make only minor changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trigger events not working in preview mode

4 participants