cSelect.ftl
1 <#-- Macro: cSelect
2
3 Description: Defines a macro that show a select tag
4
5 Parameters:
6 @param - name - string - optional - required - the name of of the element
7 @param - class - string - optional - the CSS class of the element, default 'custom-select'
8 @param - size - string - optional - permet d'ajouter un suffixe à la classe CSS 'form-control', valeur possible 'lg' ou 'sm'
9 @param - id - string - optional - the ID of the element, default ''
10 @param - helpMsg - string - optional - Content of the help message for radio, default ''
11 @param - errorMsg - string - optional - Content of the error message for radio, default ''
12 @param - params - optional - additional HTML attributes to include in the ckeckbox element default ''
13 @param - multiple - boolean - optional - Set multiple attribute to select default false
14 @param - disabled - boolean - optional - Disable element, default false
15 @param - readonly - boolean - optional - Set element readonly, default false
16 @param - checked - boolean - optional - Check the element, default false
17 @param - required - boolean - optional - Set element as required, default false
18 @param - autocomplete- string - Default '' , autocomplete pour l'input https://developer.mozilla.org/fr/docs/Web/HTML/Attributes/autocomplete
19 @param - html5Required - boolean - optional - permet d'indiquer si le champs doit utliser l'attribut html5 required (par défaut: true)
20 -->
21 <#macro cSelect name class='form-select' size='' id='' params='' multiple=false disabled=false autocomplete='' readonly=false required=false html5Required=true helpMsg='' errorMsg='' deprecated...>
22 <@deprecatedWarning args=deprecated />
23 <#assign idMsg><#if id!=''>${id}<#else>${name!}</#if></#assign>
24 <#if helpMsg !=''><@cFormHelp idMsg helpMsg /></#if>
25 <select name="${name!}" class="${class!}<#if size!=''> form-select-${size!}</#if><#if errorMsg!=''> is-invalid</#if>"<#if id!=''> id="${id}"</#if><#if autocomplete!=''> autocomplete="${autocomplete}"</#if><#if params!=''> ${params}</#if><#if disabled> disabled</#if><#if required> <#if html5Required>required</#if> aria-required="true"</#if><#if readonly> readonly</#if><#if multiple> multiple</#if><#if errorMsg!=''> aria-invalid="true" aria-describedby="error_${idMsg!}"<#elseif helpMsg!=''> aria-describedby="help_${idMsg!}"</#if>>
26 <#nested>
27 </select>
28 <#if errorMsg!=''><#assign idMsg><#if id!=''>${id}<#else>${name!}</#if></#assign><@cFormError idMsg errorMsg /></#if>
29 </#macro>