Crud switch label #1301
Replies: 3 comments 1 reply
-
🚨 Bot is not sure about this answer. Please verify. 🚨 Based on the information from the knowledge sources, the For changing the width of the switch, you might need to customize the CSS associated with the switch field. Unfortunately, the provided knowledge sources do not include specific instructions or examples for adjusting the switch width. Regarding dynamically changing the // Example JavaScript to change the label dynamically
field.wrapper.find('label').text('New Label'); This approach involves using JavaScript to locate the label element and modify its text content. However, this is a general suggestion and may require adaptation to fit your specific use case. For more detailed guidance, you might want to explore the Backpack documentation or community forums further: Backpack Documentation. If you have more specific requirements or need further assistance, consider reaching out to the Backpack community for more tailored advice. ℹ️ Please note our AI Bot does not reply to follow-ups, this will be the only AI answer in this thread. If the AI helped you find the answer, please mark it as answered or write details below so it can learn. Then close the conversation. If not, please give more information for when a human reads this. ℹ️ Relevant sources: Github Issue (closed): Field improvement proposals - for, setLabelFromFormRequest and others |
Beta Was this translation helpful? Give feedback.
-
Hello @blondie63, The best approach in this case is to create a custom field based on the existing switch field. This will allow you to customize the width and dynamically update the label using JavaScript as needed. You can generate a custom field by running:
Once generated, you can modify the field’s Blade view and add JavaScript logic to adjust the width dynamically or change the label based on the switch state. Let me know if you need help implementing this! 🚀 Cheers! |
Beta Was this translation helpful? Give feedback.
-
@jcastroa87 Thanks, i'll try to do or is better to wait Backpack v7 ? :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Looking on doc https://backpackforlaravel.com/docs/6.x/crud-fields#switch-1 i see that switch field can have:
label
onLabel
offLabel
because switch have fixed width onLabel & offLabel must be very short
Is there a way to change switch width or dynamical change 'label' ?
Beta Was this translation helpful? Give feedback.
All reactions