close-only for modal
See original GitHub issueHello,
Right now, there is an option for ok-only
to display action button. Would it be possible to add a cancel-only
prop, so we can show only the cancel button ?
Simple use case would be: modal containing a call to action, but the user cannot meet the requirement, so the only choice is to close the modale. ex:
<b-modal
@ok="submit"
@shown="fetchContent"
:ok-title="trans('submit')"
:cancel-only="errors.length > 0"
></b-modal>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:11 (8 by maintainers)
Top Results From Across the Web
modal within a modal - how to close only the inner modal
I added an id to the button used to close the inner modal (say 'closeMyModal), and then defined the following function: $(".closeMyModal").click ...
Read more >Modal - Bootstrap
Modals are built with HTML, CSS, and JavaScript. · Clicking on the modal “backdrop” will automatically close the modal. · Bootstrap only supports...
Read more >Modal Form Prevent Closing - Material Design for Bootstrap
Hi Team - I have a modal form that opens and fires when a button is clicked. The modal form is displayed as...
Read more >Bootstrap close only one modal, Close active modal, Data-dismiss ...
Bootstrap close only one modal. Click the above button to open Bootstrap modal. Now, click outside of the modal and check if its...
Read more >Modal and overlay behavior - When to close the modal
If a modal contains critical information that cannot be recovered, it should close only when a close button is explicitly clicked.
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 Free
Top 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
When overriding the footer, you are removing the “built in” OK & Cancel buttons, so you are also removing the “built-in” event handlers, as all the logic is now moved into your own app or component. So you’ll have to write your own handler that checks for a condition and prevents the modals visibility from being set to
false
(basically the same logic you would have used when callinge.cancel()
):@tristanbes You can also work around this by firing the components
hde()
method and pass the boolean primitivestrue
orfalse
tohide()
(note they must be booleans, not truthy/falsey values). This will trigger theok
andcancel
events on the component: