No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Accessing FileList of UploadItem in DynamicForm

    SmartClient Version: v12.0p_2019-06-12/LGPL Deployment (built 2019-06-12)
    Browser: Chrome Version 78.0.3904.70 (Official Build) (64-bit)

    In HTML and vanilla JavaScript, I am able to access the FileList of a form input of type "file" as follows:

    function printFileNames() {
    let files = document.getElementById("file-item").files
    for (let file of files) {
    <input id="file-item" type="file" multiple="true"/>
    <input type="button" value="Submit" onclick="printFileNames()"/>

    Is there a way I can access the FileList of an UploadItem in a DynamicForm?

    We haven't yet provided a wrapper around the native APIs here, but if you're comfortable doing so, you can directly use the native API.

    If you do so with the <input> rendered by our UploadItem, this is technically breaking the rules (the DOM is undocumented because from time to time we need to change it to work around browser bugs), however, this particular instance of reliance on the rendered DOM structure is rather unlikely to break in the future. The most stable way to access the element would be to apply a custom style and select the element via that style.

    Another way to do it would be to just create the <input> in HTML yourself, inside an HTMLFlow.


      I'll try that. Thank you.