How can i use render to render a page in pylons with a named anchor?

102 views Asked by At

I need to render a page after a formencode validation.

html = render('/billing_errors/index.mako')

This page contains tabs that are anchored.

     <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>

This is what i'm currently doing after formencode returns an error.

        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)

how can i get htmfill.render() to return the and display the named anchor.

1

There are 1 answers

0
Wael Ben Zid El Guebsi On

You need only to specify the _achnor argument e.g

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