2012-03-31 2 views
2

편집 : 오늘 나는 문자열 상수를 확인하는 교훈을 배웠습니다. 해결책은 템플릿에서 "필터"를 "필터"로 변경하는 것이 었습니다.필터가있는 간단한 검색 상자 만들기

일부 필터를 적용하기 위해 4 개의 확인란이있는 간단한 검색 상자를 만들려고합니다. 문제는 체크 박스가 dev 모드로 체크 된 경우에도 true를 반환하지 않는다는 것입니다.

내 HTML - 템플릿과 같이 정의된다

val searchBox = Form(
    tuple("search" -> nonEmptyText, 
    "filters" -> mapping(
    "filterpublic" -> boolean, 
    "filterprivate" -> boolean, 
    "filterstream" -> boolean, 
    "filterdownload" -> boolean 
    ) (Filters.apply) (Filters.unapply) 
) 

) :

@form(action = routes.Application.getResults, 'id -> "searchBox") { 

    <fieldset> 
    <legend>Searchbox</legend> 
    @inputText(field = searchBox("search"), args = '_label -> "search", 
     'placeholder -> "Type here!") 

    @checkbox(field = searchBox("filter.filterpublic"), args = 
'_label -> None, '_text -> "public") 

@checkbox(field = searchBox("filter.filterprivate"), args = 
'_label -> None, '_text -> "private") 

    @checkbox(field = searchBox("filter.filterstream"), args = 
'_label -> None, '_text -> "streamable") 

@checkbox(field = searchBox("filter.filterdownload"), args = 
'_label -> None, '_text -> "downloadable") 

    <input type="submit" id="submit"> 
    </fieldset> 
} 

나는 Filters이 4 bools을 들고 경우 클래스 래퍼 같은 내 양식을 정의

나는 이것이 무엇을 막을 수 있는지에 대해 완전히 혼란 스럽다. 연극에 대한 자습서를 참조했습니다! 이 특정 문제를 해결 한 항목을 찾을 수 없습니다.

답변

0

템플릿에서 '필터'를 '필터'로 변경해야한다고 생각합니다. 따라서 'filter.filterpublic'대신 'filters.filterpublic'을 입력하십시오.