BLOGS

Select Multiple Files Using JavaScript In FileMaker
Justification of Topic:

How to select multiple files using JavaScript and create separate records in the FileMaker application. It will work in the FileMaker Windows version.

 

Introduction:

One of our customers asked for the ability to select multiple files from FileMaker, but unfortunately, there is no option to select multiple files.

To overcome this problem, we have found a solution to select multiple files from FileMaker using JavaScript. When we call this JavaScript in the FileMaker Web Viewer, it will allow selecting multiple files and will copy the selected path. We can then process the copied path and create a separate record in FileMaker.

 

Steps to select multiple files in FileMaker.

Step 1: Create a Web Viewer

  • Create Web viewer and call the following JavaScript

“<!DOCTYPE html>

<html>

<body>

<input id=\”demo2\” type=\”file\” name=\”demo\” multiple onchange=\”getFiles()\”  />

<script>

function getFiles(){

copyTextToClipboard(document.getElementsByName(‘demo’)[0].value);

}

function fallbackCopyTextToClipboard(text) {

var textArea = document.createElement(‘textarea’);

textArea.value = text;

textArea.style.top = ‘0’;

textArea.style.left = ‘0’;

textArea.style.position = ‘fixed’;

document.body.appendChild(textArea);

textArea.focus();

textArea.select();

try {

var successful = document.execCommand(‘copy’);

var msg = successful ? ‘successful’ : ‘unsuccessful’;

} catch (err) {

}

document.body.removeChild(textArea);

}

function copyTextToClipboard(text) {

if (!navigator.clipboard) {

fallbackCopyTextToClipboard(text);

return;

}

navigator.clipboard.writeText(text).then(function() {

}, function(err) {

});

}

</script>

</body>

</html>”

  • It will allow selecting multiple files and copying the selected path. Please see the below screenshot.

Step 2: Create a script to add separate records for the selected path.

  • Paste the copied path in a separate field.
  • The path can be separated by a new line character.
  • Using the paths will create separate records.
  • Please see the screenshot below for more information.
  • After executing the above script, it will create separate records for the selected path, like below.
Conclusion:

In conclusion, The team at FMDBSolutions hopes this article taught about how to select multiple files using JavaScript in FileMaker. FMDBSolutions is a team of well-qualified experts that have a lot of experience with the many versions of FileMaker Pro and the FileMaker Go app too.

Our team knows all about transitioning, migrating, converting, and upgrading for FileMaker. Companies that require FileMaker Integration can also use our services. Naethra Technologies Pvt Ltd have worked with clients from the USA, Australia, and Singapore and will complete your FileMaker assignment in the best possible way at a lower price but at the same or higher level of excellence.

Most popular