Commit 1e371494 authored by Jérome Perrin's avatar Jérome Perrin

ERP5Form/ListBox: display error wrapper for editable fields with link

only the case without an URL column was properly handled
parent fe81e31d
......@@ -2,12 +2,12 @@
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Title Line</title>
<title>Editable fields validation errors</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test that and Editable Column has no Link</td></tr>
<tr><td rowspan="1" colspan="3">Editable fields validation errors</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/ListBoxZuite_CommonTemplate/macros/init" />
<tr>
......@@ -76,6 +76,116 @@
<td></td>
<td>Make sure there is an input tag in line 1 col 1</td>
</tr>
<tr>
<td>type</td>
<td>//*[@class="listbox-data-line-0 DataA"]//td[3]/input</td>
<td>X</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>Base_edit:method</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>//*[@class="listbox-data-line-0 DataA"]//td[3]/input</td>
<td>X</td>
</tr>
<tr>
<td>assertText</td>
<td>//*[@class="listbox-data-line-0 DataA"]//td[3]/span[@class="error"]</td>
<td>You did not enter a floating point number.</td>
</tr>
<!-- prevent "you have unsaved changes" beforeunload warning -->
<tr>
<td>storeEval</td>
<td>window.changed = false</td>
<td>_</td>
</tr>
<!-- now check with an URL column -->
<tr>
<td>open</td>
<td>${base_url}/Foo_view/listbox/manage_main</td>
<td>X</td>
</tr>
<tr>
<td>assertValue</td>
<td>field_url_columns</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>field_url_columns</td>
<td>quantity |</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>submit</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Content changed</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/foo_module/0</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//*[@class="listbox-data-line-0 DataA"]//td[3]/input</td>
<td>X</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>Base_edit:method</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//*[@class="listbox-data-line-0 DataA"]//td[3]/input</td>
<td>X</td>
</tr>
<tr>
<td>verifyText</td>
<td>//*[@class="listbox-data-line-0 DataA"]//td[3]/span[@class="error"]</td>
<td>You did not enter a floating point number.</td>
</tr>
<tr>
<td>storeEval</td>
<td>window.changed = false</td>
<td>_</td>
</tr>
<!-- restore listbox configuration -->
<tr>
<td>open</td>
<td>${base_url}/Foo_view/listbox/manage_main</td>
<td>X</td>
</tr>
<tr>
<td>assertValue</td>
<td>field_url_columns</td>
<td>quantity |</td>
</tr>
<tr>
<td>type</td>
<td>field_url_columns</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>submit</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Content changed</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -2544,6 +2544,8 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
else:
cell_html = u''
if error_message:
error_message = u' <span class="error">%s</span>' % error_message
if url is None:
html = cell_html + error_message
else:
......@@ -2551,8 +2553,8 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
html = u'%s' % cell_html
else:
html = u'<a href="%s">%s</a>' % (url, cell_html)
if error_message not in ('', None):
html += u' <span class="error">%s</span>' % error_message
if error_message:
html += error_message
else:
# If not editable, show a static text with a link, if enabled.
html = html_quote(processed_value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment