Your first code example will not work, the second is on the right track, but may have a typo in deform button class name. Compare yours to mine. You almost got it, keep on trying.
According to API docs either pass a sequence of strings or a sequence of button objects.
buttons
A sequence of strings or deform.form.Button objects
representing submit buttons that will be placed at the bottom of the
form. If any string is passed in the sequence, it is converted to
deform.form.Button objects.
Therefore I create a single button with applied CSS class and pass it in a tuple to parameter buttons
while creating the form. This example is using deform2.0a2
class WikiViews(object):
def __init__(self, request):
self.request = request
@property
def wiki_form(self):
schema = WikiPage()
submit = deform.Button(name='submit', css_class='red')
return deform.Form(schema, buttons=(submit,))
@view_config(route_name='wikipage_add',
renderer='deform2_demo:templates/wikipage_addedit.pt')
def wikipage_add(self):
form = self.wiki_form.render()
...
deform renders this to HTML:
<form id="deform" method="POST" enctype="multipart/form-data" accept-charset="utf-8" class="deform">
<fieldset class="deformFormFieldset">
<input type="hidden" name="_charset_">
<input type="hidden" name="__formid__" value="deform">
<div class="form-group item-title" title="" id="item-deformField1">
<label for="deformField1" class="control-label required" id="req-deformField1">Title</label>
<input type="text" name="title" value="" id="deformField1" class=" form-control ">
</div>
<!-- removed HTML for more deform fields -->
<div class="form-group">
<button id="deformsubmit" name="submit" type="submit" class="btn btn-primary red" value="submit">Submit</button>
</div>
</fieldset>
</form>