Skip to content

Multi checkbox with value from Form #58

@Selsynn

Description

@Selsynn

I use v1.0 for play 2.4 and Bootstrap 3.

I have an array of checkbox of name transports[id] and value id, but I can't find how to check or not check the value from the form value.
The choices displayed by the checkbox is from a model transports where there is an id and a name (text value).

I tested
views :
@b3.checkboxgroup( transports.map { case ((id, name)) => (searchForm(s"transports[$id]"), Seq(('_text -> name),('value -> id))) }.toSeq: _*)('_label -> Messages("form.filter.transport.type"), 'class -> "multi-checkbox-list")(b3.inline.fieldConstructor, implicitly[Messages])

and
B3/checkboxgroup.scala.html
@(fieldsWithArgs: (Field, Seq[(Symbol,Any)])*)(globalArgs: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) @b3.multifield(fieldsWithArgs.map(_._1):_*)(globalArgs, fieldsWithArgs.map(_._2).flatten) { implicit cfc => <div @toHtmlArgs(bs.Args.inner(globalArgs).toMap)> @fieldsWithArgs.map { case (field, fieldArgs) => @b3.checkbox(field, fieldArgs:_*) } </div> }

and in the views, all my checkbox are always checked. Even if I write ('checked -> "false") on the arguments, the result is always the same.
Is it normal because I don't use correctly the library or is it a bug ?

(I'm not very fluent in writing english, i'm sorry)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions