Buttons¶
- References
Bases:
crispy_forms.layout.ButtonHolderIt wraps fields in an element
<div class="button-holder">.This is where you should put Layout objects that render to form buttons like Submit. It should only hold
HTMLandBaseInputinherited objects.Example:
ButtonHolder( HTML(<span style="display: hidden;">Information Saved</span>), Submit('Save', 'Save') )
Bases:
crispy_forms_foundation.layout.buttons.ButtonHolderAct like
ButtonHolderbut add acalloutclass name on the maindiv.
Bases:
crispy_forms.layout.LayoutObjectIt wraps fields in an element
<div class="button-group">.This is where you should put Layout objects that render to form buttons like Submit. It should only hold HTML and BaseInput inherited objects.
Example:
ButtonGroup( Submit('Save', 'Save'), Button('Cancel', 'Cancel'), )
Bases:
crispy_forms_foundation.layout.buttons.InputButtonThis is the old Button object that inherit from
InputButtonfor backward compatibility.If you want to stand for an input button, you are invited to use
InputButtoninstead to avoid problem whenButtonElementwill become the newButtonobject.
Bases:
crispy_forms_foundation.layout.buttons.InputSubmitThis is the old Button object that inherit from
InputSubmitfor backward compatibility.If you want to stand for an input button, you are invited to use
InputSubmitinstead to avoid problem whenButtonSubmitwill become the newSubmitobject.
Bases:
crispy_forms_foundation.layout.buttons.InputResetThis is the old Button object that inherit from
InputResetfor backward compatibility.If you want to stand for an input button, you are invited to use
InputResetinstead to avoid problem whenButtonResetwill become the newResetobject.
Bases:
crispy_forms.layout.BaseInputUsed to create a Submit input descriptor for the {% crispy %} template tag:
button = InputButton('Button 1', 'Press Me!')
Note
The first argument is also slugified and turned into the id for the button.
Bases:
crispy_forms.layout.BaseInputUsed to create a Submit button descriptor for the {% crispy %} template tag:
submit = Submit('Search the Site', 'search this site')
Bases:
crispy_forms.layout.BaseInputUsed to create a Reset button input descriptor for the
{% crispy %}template tag:reset = Reset('Reset This Form', 'Revert Me!')
Bases:
crispy_forms.layout.BaseInputContrary to
Button, ButtonElement purpose use a<button>element to create a clickable form button and accept an argument to add free content inside element.Advantage of
<button>is to accept almost any HTML content inside element.button = ButtonElement('name', 'value', content="<span>Press Me!</span>")
Note
First argument is for
nameattribute and also turned into the id for the button;Second argument is for
valueattribute and also for element content if not given;Third argument is an optional named argument
content, if given it will be appended inside element instead ofvalue. Content string is marked as safe so you can put anything you want;
Renders an <input /> if container is used as a Layout object. Input button value can be a variable in context.
Bases:
crispy_forms_foundation.layout.buttons.ButtonElementCreate a submit button following the
ButtonElementbehaviors:button = ButtonSubmit('search', 'go-search', content="<span>Search this site!</span>")
Bases:
crispy_forms_foundation.layout.buttons.ButtonElementCreate a reset button following the
ButtonElementbehaviors:button = ButtonReset('reset', 'revert' content="<span>Revert Me!</span>")