controller target access problem
See original GitHub issuehey,
is it possible to have multiple data-content-loader-url on one controller for different elements amd also data-targets. like that
<div data-controller="myController" data-content-loader-url="/api/test">
<select data-controller="myController" data-content-loader-url="/api/loader-1" data-target.loader1 >
</select>
<select data-controller="myController" data-content-loader-url="/api/loader-2" data-target="myController.loader2">
</select>
<select data-controller="myController" data-content-loader-url="/api/loader-3" data-target="myController.loader3">
</select>
</div>
i have created the static methog like that:
static get targets() {
return ["loader1","loader2","loader3"]
}
when i try to access the the input variables like this.:
let loader 3 = this.loader3Target.value
i get the following error
Error invoking action "click->myController#saveLoader"
Error: Missing target element "myController.loader3"
Stack trace:
get@http://localhost:3000/js/stimulus.umd.js:5:1548
saveProjectDetails@http://localhost:3000/js/main.js:326:8
E</t.prototype.invokeWithEvent@http://localhost:3000/js/stimulus.umd.js:5:3143
E</t.prototype.handleEvent@http://localhost:3000/js/stimulus.umd.js:5:2684
It worked if i had different contrller for the targets and the content url loader
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
controller target access problem · Issue #142 · hotwired/stimulus
So, you demand myController.loader3Target on method saveLoader() using DOM element without data-target="myController.loader3" , am i right?
Read more >Target account name is incorrect - Windows Server
This can occur when the target server principal name (SPN) is registered on an account other than the account the target service is...
Read more >How to fix 8 common remote desktop connection problems
2. Firewall problems · Open the Control Panel by entering Control at the Windows Run prompt · Click System and Security · Click...
Read more >Target Access Problems by Authentication Protocol - Tenable
1) A plugin tried to access a resource that requires a special privilege level such as NT_AUTHORITY on Windows. · 2) Environmental issues...
Read more >Login Failure Target Account Name is Incorrect - Spiceworks
... to access using its FQDN i.e. Server-A Error : Login Failure Target ... target account name is incorrect error is if a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Every controller+identifier pairing creates a new scope, which allows nested controller elements to function independently. Nested controller elements are isolated from parent elements with the same identifier. For example:
The controller for
b
will have 2viewTargets
anda
will have 0 (because they both belong tob
’s scope).My point was that propably you demand all variables (loader1, loader2 and loader3) on your action saveLoader but you have 3 instances of your controller “myController”, each one with different loader. So if i’m right you have something like that:
<select data-controller="myController" data-content-loader-url="/api/loader-1" data-target="myController.loader1" > </select>
and in your saveLoader:let loader3 = this.loader3Target.value
which should end with errorMissing target element "myController.loader3"
because you have only loader1.Is that your case? If not - i don’t understand what you want to achieve and can’t help you. Can you share with us your “MyController” code and full HTML where that controller is used?