Various forms2 changes

This commit is contained in:
Lance Edgar 2017-12-07 20:35:44 -06:00
parent 587871e87c
commit 1e8a4534d5
5 changed files with 35 additions and 25 deletions

View file

@ -127,6 +127,17 @@
${self.extra_javascript()}
${self.core_styles()}
${self.extra_styles()}
## TODO: should this be elsewhere / more customizable?
% if dform is not Undefined:
<% resources = dform.get_widget_resources() %>
% for path in resources['js']:
${h.javascript_link(request.static_url(path))}
% endfor
% for path in resources['css']:
${h.stylesheet_link(request.static_url(path))}
% endfor
% endif
</%def>
<%def name="core_javascript()">

View file

@ -2,7 +2,7 @@
% if not readonly:
<% _focus_rendered = False %>
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data')}
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data', class_='autodisable')}
${h.csrf_token(request)}
% endif
@ -26,7 +26,11 @@ ${h.csrf_token(request)}
## <div class="field-error">${error}</div>
## % endfor
% if field.error:
<div class="field-error"><span class="error-msg">${field.error.msg}</span></div>
<div class="field-error">
% for msg in field.error.messages():
<span class="error-msg">${msg}</span>
% endfor
</div>
% endif
<div class="field-row">
<label for="${field.oid}">${field.title}</label>

View file

@ -6,15 +6,6 @@
<%def name="extra_javascript()">
${parent.extra_javascript()}
${self.disable_button_js()}
% if dform is not Undefined:
<% resources = dform.get_widget_resources() %>
% for path in resources['js']:
${h.javascript_link(request.static_url(path))}
% endfor
% for path in resources['css']:
${h.stylesheet_link(request.static_url(path))}
% endfor
% endif
</%def>
<%def name="disable_button_js()">

View file

@ -18,15 +18,6 @@
});
</script>
% if dform is not Undefined:
<% resources = dform.get_widget_resources() %>
% for path in resources['js']:
${h.javascript_link(request.static_url(path))}
% endfor
% for path in resources['css']:
${h.stylesheet_link(request.static_url(path))}
% endfor
% endif
</%def>
<%def name="context_menu_items()">