我需要在表单代码验证后呈现一个页面。
html = render('/billing_errors/index.mako')
此页面包含锚定的选项卡。
<ul id="tabs" class="tabs">
<li><a href="#retail" class="selected">Retail</a></li>
<li><a href="#wholesale">Wholesale</a></li
<li><a href="#kroom">K Rooms</a></li>
</ul>
<div id="kroom">
<div class="span-6">
<br />
</div>
<div class="span-12 last">
<fieldset>
<legend>Insert BT Op-Assist Room</legend>
%if h.auth.authorized(h.auth.is_infinite_billing_manager):
<form method="post" action="${h.url(controller='billing_errors', action='save')}">
<%form:text label="Account" name="acctgrpid" />
<%form:text label="Room" name="accountid" />
${h.hidden('action', 'bt op- assist')}
<%form:okcancel
positive="Insert"
negative="Cancel"
negative_url="${h.url(controller='billing_errors', action='index')}"/>
%endif
</form>
</fieldset>
</div>
</div>
这是我在formencode返回错误后目前正在做的事情。
try:
values = dict(request.params)
form_result = schema.to_python(values, state=Struct(session=Session))
except Invalid, error:
form_results = values
form_errors = error.error_dict or {}
return htmlfill.render(html, defaults=form_results, errors=form_errors)
我怎样才能让 htmfill.render() 返回并显示命名的锚点。