Avoid "auto disable" button logic for new message form
This commit is contained in:
parent
22236e2909
commit
5b4718fac4
|
@ -323,6 +323,7 @@ class Form(object):
|
||||||
save_label = "Save"
|
save_label = "Save"
|
||||||
update_label = "Save"
|
update_label = "Save"
|
||||||
show_cancel = True
|
show_cancel = True
|
||||||
|
auto_disable = True
|
||||||
|
|
||||||
def __init__(self, fields=None, schema=None, request=None, readonly=False, readonly_fields=[],
|
def __init__(self, fields=None, schema=None, request=None, readonly=False, readonly_fields=[],
|
||||||
model_instance=None, model_class=None, nodes={}, enums={}, labels={}, renderers=None,
|
model_instance=None, model_class=None, nodes={}, enums={}, labels={}, renderers=None,
|
||||||
|
@ -685,6 +686,9 @@ class Form(object):
|
||||||
context = kwargs
|
context = kwargs
|
||||||
context['form'] = self
|
context['form'] = self
|
||||||
context['dform'] = dform
|
context['dform'] = dform
|
||||||
|
context['form_kwargs'] = {}
|
||||||
|
if self.auto_disable:
|
||||||
|
context['form_kwargs']['class_'] = 'autodisable'
|
||||||
context['request'] = self.request
|
context['request'] = self.request
|
||||||
context['readonly_fields'] = self.readonly_fields
|
context['readonly_fields'] = self.readonly_fields
|
||||||
context['render_field_readonly'] = self.render_field_readonly
|
context['render_field_readonly'] = self.render_field_readonly
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
% if not readonly:
|
% if not readonly:
|
||||||
<% _focus_rendered = False %>
|
<% _focus_rendered = False %>
|
||||||
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data', class_='autodisable')}
|
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data', **form_kwargs)}
|
||||||
${h.csrf_token(request)}
|
${h.csrf_token(request)}
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,9 @@ class MessagesView(MasterView):
|
||||||
def configure_form(self, f):
|
def configure_form(self, f):
|
||||||
super(MessagesView, self).configure_form(f)
|
super(MessagesView, self).configure_form(f)
|
||||||
|
|
||||||
|
# we have custom logic to disable submit button
|
||||||
|
f.auto_disable = False
|
||||||
|
|
||||||
# TODO: A fair amount of this still seems hacky...
|
# TODO: A fair amount of this still seems hacky...
|
||||||
|
|
||||||
f.set_renderer('sender', self.render_sender)
|
f.set_renderer('sender', self.render_sender)
|
||||||
|
|
Loading…
Reference in a new issue