Remove form tag when no action is defined
authorThierry Florac <thierry.florac@onf.fr>
Fri, 10 Nov 2017 13:26:22 +0100
changeset 71 3de99bc70b7a
parent 70 11e7ab3bd0da
child 72 8969b8950fed
Remove form tag when no action is defined
src/pyams_form/templates/form.pt
--- a/src/pyams_form/templates/form.pt	Fri Oct 13 10:20:12 2017 +0200
+++ b/src/pyams_form/templates/form.pt	Fri Nov 10 13:26:22 2017 +0100
@@ -23,9 +23,11 @@
 			 tal:content="structure prefix">Form prefix</div>
 		<form method="post"
 			  data-async
+			  tal:define="action view.get_form_action()"
+			  tal:omit-tag="not:action"
 			  tal:attributes="id view.id;
 							  name view.name;
-							  action view.get_form_action();
+							  action action;
 							  method view.method;
 							  enctype view.enctype;
 							  acceptCharset view.acceptCharset;
@@ -38,7 +40,8 @@
 							  data-ams-form-submit-target view.form_target | nothing;
 							  data-ams-form-download-target view.download_target | nothing;
 							  data-ams-warn-on-change view.warn_on_change;">
-			<div class="modal-viewport">
+			<div class="modal-viewport"
+				 tal:attributes="class 'modal-viewport {0}'.format(view.css_class if not action else '')">
 				<fieldset tal:attributes="class view.fieldset_class | default">
 					<legend tal:define="legend view.legend"
 							tal:condition="legend">