How to use @select (scala view) in custom html tag (view)

java

(Ali) #1

Hello everybody,

I would like to convert this :

			@select(
                telephoneForm("service.id"), 
                options(services),
                '_label -> "service", 
				'_default -> "-- Choisir un service --",
                '_showConstraints -> false
            )

To an HTML tag custom ( i use here bootstrap )


						  <div class="control-group">
                                <label class="control-label">Custom Dropdown</label>
                                <div class="controls">
                                    <select class="span6 chzn-select" data-placeholder="Choose a Category" tabindex="1">
                                        <option value=""></option>
                                        <option value="Service 1">Service 1</option>
                                        <option value="Service 2">Service 2</option>
                                        <option value="Service 3">Service 3</option>
                                        <option value="Service 4">Service 4</option>
                                    </select>
                                </div>
                          </div>

Of course services is a MAP declared on header of the form like this :

@(telephoneForm: Form[Telephone], services: Map[String, String])
@import helper._

Thank you so much


(Ali) #2

In this forum! no one helps! :fearful::disappointed_relieved::zipper_mouth_face:


(Marcos Pereira) #3

Hi @placebo86,

This is a forum where the community helps on a best effort basis.

Given that, if you want full control of the rendered select, then you should write most of HTML by yourself. What you can do is write most of the wrapping divs using plain HTML, and only the select portion using the helper:

<div class="control-group">
    <label class="control-label">Custom Dropdown</label>
    <div class="controls">
        @select(...)
    </div>
</div>