diff options
author | Mitch Jackson <mitch@freeside.biz> | 2018-06-13 02:25:09 -0500 |
---|---|---|
committer | Mitch Jackson <mitch@freeside.biz> | 2018-06-13 02:27:23 -0500 |
commit | 381992561d7b1a88e05d49d3e474a2fad25873c7 (patch) | |
tree | a54cb4f63da0a40f666ad8f62439e7621591d61b /httemplate/elements/link-replace_element_text.html | |
parent | 360f89789c45e1fd7cb84b1442d2f0c8353066d9 (diff) |
RT# 32234 Allow unmask of SSN/DL#
Diffstat (limited to 'httemplate/elements/link-replace_element_text.html')
-rw-r--r-- | httemplate/elements/link-replace_element_text.html | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/httemplate/elements/link-replace_element_text.html b/httemplate/elements/link-replace_element_text.html new file mode 100644 index 000000000..8e611954c --- /dev/null +++ b/httemplate/elements/link-replace_element_text.html @@ -0,0 +1,45 @@ +<%doc> + +Display a link with javascript to replace text within a element. + +Usage: + +<& /elements/link-replace_element_text.html, { + target_id => 'input_id', + replace_text => 'hello', + + element_type => 'input', # Uses jquery val() method to replace text + element_type => 'div', # Uses jquery text() method to replace text + + href => ... + style => ... + class => ... + } +&> + +</%doc> +<a href="<% $param{href} %>" + style="<% $param{style} %>" +% if ($param{class}) { + class="<% $param{class} %>" +% } + onClick="$('#<% $param{target_id} %>').<% $param{jmethod} %>('<% $param{replace_text} |h %>');">◁</a> +<%init> + +die "template call requires a parameter hashref" unless ref $_[0]; + +# Defaults that can be overridden in param hashref +my %param = ( + target_id => 'SPECIFY_AN_INPUT_ELEMENT_ID', + replace_text => 'REPLACEMENT_TEXT_FOR_INPUT_ELEMENT', + element_type => 'input', + + link_text => '%#x25C1;', # ◁ + href => 'javascript:void(0)', + style => 'text-decoration:none;', + class => undef, + + %{ $_[0] }, +); +$param{jmethod} = $param{element_type} eq 'input' ? 'val' : 'text'; +</%init> |