Home > WebEOC > Admin Guide > Board Building Tips > Show Names of File Attachments

Show Names of File Attachments

Table of contents
No headers

To show the file name of an uploaded file attachment on the input view of a board, use the following code. This code works for multiple files: just give the file input box a class of "fileinput" and create a corresponding hidden field to house the name.

<script type="text/javascript">
function GrabFileName() {
  var inputs = document.getElementsByTagName('input');
  for (var i = 0; i &lt; inputs.length; i++) {
    if(inputs[i].className.indexOf("fileinput") &gt; -1) {
      var pathParts = inputs[i].value.split('\\');
      document.getElementById(inputs[i].id + 'Name').value = pathParts[pathParts.length-1];
function SetSubmitHandler()
  document.forms[0].onsubmit = GrabFileName;

For each input field, add the following:

<input type="text" style="display:none;" name="file1Name" id="file1Name"></input>
<if test="not(/data/node()[@file1]) or /data/node()/@file1=0">
<input type="file" name="file1" class="fileinput" id="file1"></input>
<if test="/data/node()/@file1!=0">
    <value-of select="/data/node()/@file1Name" />
You must to post a comment.
Last modified



This page has no classifications.