I created a Bootstrap form with the following footer:
<div class="modal-footer">
<button type="button"
class="btn btn-secondary"
data-bs-dismiss="modal" // <----------------------
>Close
</button>
<button type="button" class="btn btn-primary">Send</button>
</div>
In Grav, I created a form that is styled like my Bootstrap form. I used the official documentation. To close the modal and the form, I need to add the custom attribute data-bs-dismiss="modal"
to the button which is generated by Grav:
buttons:
-
type: reset
value: Cancel
classes: btn btn-secondary mx-3
attributes: data-bs-dismiss="modal" <-------- add custom attribute how?
-
type: submit
value:
classes: btn btn-primary
process: ...
My example code does not work.
How do I add a custom attribute in the form frontmatter so it is generated by Grav with the button?
There is no documentation what additional attributes or values are accepted by the Grav form plugin so I am at a loss. Just clicking anywhere on the screen is fine but I cannot expect all the not-as-tech-savy users to know this so I also need a button.
question from:
https://stackoverflow.com/questions/66059072/add-custom-html-attribute-to-buttons-of-a-grav-generated-form 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…