[Catalyst] uri_for doesn't work

Stuart Dodds stuart at doddsweb.co.uk
Thu Oct 30 10:44:03 GMT 2008


Your code looks ok, but what could be wrong is the catalyst variable you 
pass to the template through the View. In most of the tutorials the 
default is:

    CATALYST_VAR => 'Catalyst',

so you could try this in your template first:

[% Catalyst.uri_for('form_create_do') %]

if it still doesnt work look at your View file and check what your 
CATALYST_VAR is actually set too. hope it helps.

Stuart.


carlo maisola wrote:
> Hi!
> Im a catalyst newbie, so im working on tutorial.
> All works fine for me except for the uri_for method. Every time i use
> it in template files, the result is nothing.
> eg.
>
> [% META title = 'Manual Form Book Create' -%]
>
> <form method="post" action="[% c.uri_for('form_create_do') %]">
> <table>
>  <tr><td>Title:</td><td><input type="text" name="title"></td></tr>
>  <tr><td>Rating:</td><td><input type="text" name="rating"></td></tr>
>  <tr><td>Author ID:</td><td><input type="text" name="author_id"></td></tr>
> </table>
> <input type="submit" name="Submit" value="Submit">
> </form>
>
> is rendered as:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
>  <head>
>    [...]
> </head>
>  <body>
> <div id="header"><!-- BEGIN site/header -->
> <h1 class="title">Manual Form Book Create</h1>
>
> <!-- END site/header -->
> </div>
>
> <div id="content">
>   <span class="message"></span>
>   <span class="error"></span>
>
>
> <form method="post" action="">
> <table>
>  <tr><td>Title:</td><td><input type="text" name="title"></td></tr>
>  <tr><td>Rating:</td><td><input type="text" name="rating"></td></tr>
>
>  <tr><td>Author ID:</td><td><input type="text" name="author_id"></td></tr>
> </table>
> <input type="submit" name="Submit" value="Submit">
> </form>
> </div>
>
> <div id="footer"><!-- BEGIN site/footer -->
> <div id="copyright">&copy; 2008 Your Name Here</div>
> <!-- END site/footer -->
> </div>
>
>  </body>
>
> </html>
>
> where is my problem? im forgetting something?
> Thanks in advance,
> Carlo
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>   



More information about the Catalyst mailing list