IHP 1.1 is out now!

Your First Project - Adding comments errors

Fluke2001
Hi, While working through 'Your First Project' I am getting hung up when I adjust the Web/View/Comments/Index.hs file. I am a raw developer, so dumbed down language appreciated. Feels like something is wrong with the html conversion.... Error here: Could not deduce (IHP.RouterSupport.AutoRoute (Id' "posts" -> CommentsController)) arising from a use of ‘pathTo’ (maybe you haven't applied a function to enough arguments?) from the context: (?context::ControllerContext, ?view::IndexView) bound by the type signature for: html :: (?context::ControllerContext, ?view::IndexView) => IndexView -> Text.Blaze.Html.Html at Web/View/Comments/Index.hs:7:5-8 • In the third argument of ‘IHP.HtmlSupport.QQ.applyAttribute’, namely ‘(pathTo NewCommentAction)’ In the expression: ((IHP.HtmlSupport.QQ.applyAttribute (Data.Text.pack "href")) (Data.Text.pack " href="")) (pathTo NewCommentAction) In the second argument of ‘IHP.HtmlSupport.QQ.applyAttributes’, namely ‘[((IHP.HtmlSupport.QQ.applyAttribute (Data.Text.pack "href")) (Data.Text.pack " href="")) (pathTo NewCommentAction), \ h_aIQT -> (h_aIQT ! ((Text.Blaze.Internal.attribute (Text.Blaze.Internal.textTag (Data.Text.pack "class"))) (Text.Blaze.Internal.textTag (Data.Text.pack " class=""))) (Text.Blaze.Internal.preEscapedTextValue (Data.Text.pack "btn btn-primary ml-4")))]’ | 7 | html IndexView { .. } = [hsx| | ^... Help would be greatly appreciated. Thanks.
marc PRO

Hey, welcome to the IHP community :)

I think the issue is that the postId argument is not passed to NewCommentAction. Can you try changing your code to this:

<a href={NewCommentAction (get #id post)}>Add Comment</a>
Fluke2001

Thanks Marc!