Closed benkelukas closed 6 years ago
The ID is in fact overwritten when the control gets assembled (the checkbox is in fact a div + label + input)
And that function always indeed transforms the name into an ID:
So in current state, I don't see a way to change the ID unfortunatly. Would you be able to submit a PR (ignore the function call if an ID is already set on the control)?
Maybe you could also tryout the changes provided in https://github.com/marvinlabs/laravel-html-bootstrap-4/pull/42 as they target specifically input names containing []
(I guess you would need to name each box as "permissions[{$permission->id}]"
Thinking outside the box, why would you need custom IDs? Would a CSS class not be enough to target the checkbox?
Hi, when using the
checkBox()
method, I'm unable to change the checkbox id and leave the name different, eg. input name = permissions, id of input: permission-1;Here is the code I've tried
But id stays the same as input name. I think the problem is in this line (219): https://github.com/marvinlabs/laravel-html-bootstrap-4/blob/f7a63019881c60d48e782de9f3af1cfbd26c339a/src/Bootstrap/Traits/BuildsForms.php#L217-L221 It should somehow accept overriden id if the method
id
is called on the returnedelement
objectCan you look into it please? Or am I doing something wrong? Thanks.