-
Notifications
You must be signed in to change notification settings - Fork 108
/
text.gsp
35 lines (34 loc) · 1.77 KB
/
text.gsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<%
config.require("label")
config.require("formFieldName")
if (config.classes && config.classes.contains("numeric-range")) {
config.require("min", "max")
}
if (config.classes && config.classes.contains("regex")) {
config.require("regex")
}
def otherAttributes = ''
if (config.otherAttributes){
config.otherAttributes.each{ attr, val ->
otherAttributes += (' ' + attr + '="' + val + '"')
}
}
%>
<p <% if (config.left) { %> class="left" <% } %> >
<label for="${ config.id }-field">
${ config.label } <% if (config.classes && config.classes.contains("required")) { %><span>(${ ui.message("emr.formValidation.messages.requiredField.label") })</span><% } %>
</label>
<input type="text" id="${ config.id }-field" name="${ config.formFieldName }" value="${ config.initialValue ?: '' }"
<% if (config.classes) { %>class="${ config.classes.join(' ') }" <% } %>
<% if (config.size) { %> size="${ config.size }" <% } %>
<% if (config.maxLength) { %> maxlength="${ config.maxLength }" <% } %>
<% if (config.classes && config.classes.contains("regex")) { %> regex="${ config.regex }" <% } %>
<% if (config.classes && config.classes.contains("numeric-range")) { %> min="${ config.min }" max="${ config.max }" <% } %>
${otherAttributes} />
<% if (config.appendToValueDisplayed) { %><span class="append-to-value">${config.appendToValueDisplayed}</span><% } %>
${ ui.includeFragment("uicommons", "fieldErrors", [ fieldName: config.formFieldName ]) }
<% if (config.appendToValue) { %><span class="append-to-value hidden">${config.appendToValue}</span><% } %>
<% if (config.optional) { %>
${ ui.message("emr.optional") }
<% } %>
</p>