2013-04-25 76 views
0

我需要在驗證碼驗證後呈現頁面。我該如何使用渲染器來渲染帶有命名錨點的掛鉤頁面?

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()返回並顯示指定的錨點。

回答

0

你只需要指定_achnor參數 e.g

h.redirect_to(controller='myController', action='myView', 
       id=user_id, _anchor="ui-tabs-2")