diff --git a/tailbone/forms2/core.py b/tailbone/forms2/core.py index 263a791d..faf2c7ca 100644 --- a/tailbone/forms2/core.py +++ b/tailbone/forms2/core.py @@ -324,6 +324,8 @@ class Form(object): update_label = "Save" show_cancel = True auto_disable = True + auto_disable_save = True + auto_disable_cancel = True def __init__(self, fields=None, schema=None, request=None, readonly=False, readonly_fields=[], model_instance=None, model_class=None, nodes={}, enums={}, labels={}, renderers=None, @@ -687,7 +689,8 @@ class Form(object): context['form'] = self context['dform'] = dform context['form_kwargs'] = {} - if self.auto_disable: + # TODO: deprecate / remove the latter option here + if self.auto_disable_save or self.auto_disable: context['form_kwargs']['class_'] = 'autodisable' context['request'] = self.request context['readonly_fields'] = self.readonly_fields diff --git a/tailbone/templates/forms2/deform.mako b/tailbone/templates/forms2/deform.mako index ee70917e..3dcbbfaf 100644 --- a/tailbone/templates/forms2/deform.mako +++ b/tailbone/templates/forms2/deform.mako @@ -77,7 +77,7 @@ ${h.csrf_token(request)} ## ${h.submit('create_and_continue', form.successive_create_label)} ## % endif % if getattr(form, 'show_cancel', True): - ${h.link_to("Cancel", form.cancel_url, class_='button autodisable')} + ${h.link_to("Cancel", form.cancel_url, class_='cancel button{}'.format(' autodisable' if form.auto_disable_cancel else ''))} % endif % endif