Alkali Metal
Alkali Metal
LOELeague of Extraordinary FoundryVTT Developers
Created by BenjiWentBananas on 8/30/2024 in #system-development
data from onchange event
You're welcome! And yeah, some of the native HTML stuff that needs to be done for Foundry gets hidden by JS frameworks, so it can be rough sometimes. Though a nice thing is that almost everything involved with Foundry dev can apply when using JS frameworks to some extent
11 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by BenjiWentBananas on 8/30/2024 in #system-development
data from onchange event
For sure! That's what is called an "data attribute" MDN has a pretty great page about it here: https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
11 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by BenjiWentBananas on 8/30/2024 in #system-development
data from onchange event
(example that doesn't use "data" as a keyword: data-some-name-you-want=2 and in the JS event.currentTarget.dataset.someNameYouWant)
11 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by BenjiWentBananas on 8/30/2024 in #system-development
data from onchange event
So instead of data=1, use data-data=1 then you access it using event.currentTarget.dataset.data
11 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by BenjiWentBananas on 8/30/2024 in #system-development
data from onchange event
Oh! Okay
11 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by BenjiWentBananas on 8/30/2024 in #system-development
data from onchange event
(event.currentTarget is the HTML Element that you put the event listener on)
11 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by BenjiWentBananas on 8/30/2024 in #system-development
data from onchange event
So the event argument in your listener is a JavaScript Event, so you probably want event.currentTarget.checked (for things like text inputs you'd do event.currentTarget.value instead)
11 replies
update item attribute on actorsheet
Yeah, it's a tad confusing at first, but I'm glad I could help point ya in the right direction. :)
4 replies
update item attribute on actorsheet
name doesn't work for embedded documents (like items), you'll need to use a change event listener that's created in the actor sheets activateListeners in order to process the data and update the correct item.
4 replies