th:field doesnt work when fragment's parameter is passed as th:object

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

th:field doesnt work when fragment's parameter is passed as th:object

vojtech
I have this fragment:

<div th:fragment="searchForm(pattern)">
    <form th:object="${pattern)">
        <input type="text" th:field="*{keyWords}"/>
    </form>
</div>

when I use this fragment:
<th:block th:replace="frags :: searchForm(${myPattern})"/>

I get this error:
Neither BindingResult nor plain target object for bean name 'pattern' available as request attribute

When I replace th:field with th:value, it works. What is wrong in my code?