Search code examples
scalaplayframework-2.2twirl

template scala Playframwork


It is my first playframework project using scala template and i m looking forward some help. When i compile my code , it generetes an error : '(' expected but ')' found

 @(produits : List[models.Produit], messages : List[String])
        <div class="container padding-top-10">
            <div class="jumbotron">
                <form class="register form-horizontal" action="@routes.Application.objectif_dc()" method="POST">

                    <label for="produit">
                        produit :
                        <br/>
                        <select name="produit" class="form-control">
                            @for ( produit <- produits){
                            <option value="@(produit.id)"> @(produit.type) </option>
                            }
                        </select>
                    </label>

                    <br/>
                    <br/>
                    <label for="cible">
                        cible :
                        <br/>
                        <select name="cible" class="form-control">
                            <option value="cdd" selected>chef de departement direct</option>
                            <option value="cdi">chef de departement indirect</option>
                        </select>
                    </label>

                    <br/>
                    <br/>
                    <label for="objectif">
                        Objectif :
                        <br/>
                        <input type="text" class="form-control" name="objectif" placeholder="objectif" value="" />
                    </label>
                    <br/>
                    <br/>
                    <button class="btn btn-default" type="submit">envoyer</button>
                </form>
            </div>
        </div>

Solution

  • Remove the space between @for and opening bracket (.

    Twirl is sensitive for such things.