Skip to content

Commit

Permalink
Added text-line.@ac-use-actual attribute to allow using the actual te…
Browse files Browse the repository at this point in the history
…xt enterred in the input box instead of just using a selected autocomplete option (edefault)
  • Loading branch information
jonesde committed May 3, 2015
1 parent 70e5d2d commit f8f50f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion framework/xsd/xml-form-1.5.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,15 @@ This Work includes contributions authored by David E. Jones, not as a
</xs:attribute>
<xs:attribute name="ac-delay" type="xs:positiveInteger" default="300"/>
<xs:attribute name="ac-min-length" type="xs:positiveInteger" default="1"/>
<xs:attribute name="ac-show-value" type="boolean" default="false"/>
<xs:attribute name="ac-show-value" type="boolean" default="false">
<xs:annotation><xs:documentation>If true the value of the currently selected option will show next to
the autocomplete input box.</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attribute name="ac-initial-text" type="xs:string" use="optional"/>
<xs:attribute name="ac-use-actual" type="boolean" default="false">
<xs:annotation><xs:documentation>If true the value enterred in the input box will be used even if no
autocomplete option is selected.</xs:documentation></xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="text-area" substitutionGroup="SubFields">
Expand Down
3 changes: 2 additions & 1 deletion runtime/template/screen-macro/DefaultScreenMacros.html.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,7 @@ a -> p, m -> i, h -> H, H -> h, M -> m, MMM -> M, MMMM -> MM
<#assign acUrlInfo = sri.makeUrlByType(.node["@ac-transition"], "transition", null, "false")>
<#assign acUrlParameterMap = acUrlInfo.getParameterMap()>
<#assign acShowValue = .node["@ac-show-value"]! == "true">
<#assign acUseActual = .node["@ac-use-actual"]! == "true">
<#if .node["@ac-initial-text"]?has_content><#assign valueText = ec.resource.evaluateStringExpand(.node["@ac-initial-text"]!, "")>
<#else><#assign valueText = fieldValue>
</#if>
Expand All @@ -1550,7 +1551,7 @@ a -> p, m -> i, h -> H, H -> h, M -> m, MMM -> M, MMMM -> MM
focus: function(event, ui) { $("#${id}").val(ui.item.value); $("#${id}_ac").val(ui.item.label); return false; },
select: function(event, ui) { if (ui.item) { this.value = ui.item.value; $("#${id}").val(ui.item.value); $("#${id}_ac").val(ui.item.label);<#if acShowValue> if (ui.item.label) { $("#${id}_value").html(ui.item.label); }</#if> return false; } }
});
$("#${id}_ac").change(function() { if (!$("#${id}_ac").val()) { $("#${id}").val(""); } });
$("#${id}_ac").change(function() { if (!$("#${id}_ac").val()) { $("#${id}").val(""); }<#if acUseActual> else { $("#${id}").val($("#${id}_ac").val()); }</#if> });
<#if !.node["@ac-initial-text"]?has_content>
/* load the initial value if there is one */
if ($("#${id}").val()) {
Expand Down

0 comments on commit f8f50f8

Please sign in to comment.