How to create a entity key form field

63 Views Asked by At

I want to create a new form field to enter an entity key, in this case an ArticleId instead of an Integer field, can I do that?

There is my Article model

Article
    title     Text
    content   Text
    userId    Int
    score     Int Maybe
    deriving  Show
    deriving  Eq

And there is my AForm Article handler

<$> areq intField (bfs ("Article Id" :: Text)) Nothing
<*> areq intField (bfs ("Tag Id" :: Text))     Nothing

I want to do this to avoid use toSqlKey in my selectList

Thanks!

0

There are 0 best solutions below