We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36723
    • 94 Posts
    Hello,

    I am having a problem populating the value of file input for a resource,
    when a user revisit the resource. I am using revo 2.0.6.

    I have a custom TV Output Type for a file. I use a template like the one below.

    <input type="file" id="tv{$tv->id}" name="tv{$tv->id}" />

    I have a plugin which then copies the file to a separate folder.

    Is there anyway to populate a hidden field so that the value isn’t lost when
    any change is made to the resource. Whenever a user makes a single change
    to the resource it loses the value for the file.

    Any help would be greatly appreciated.

    Thanks,
    Bart


      • 18373 ☆ A M B ☆
      • 3,141 Posts
      I assume there’s a snippet on your resource (formit, or something custom made) that is capable of setting placeholders. You could then set the [[+tvname]] placeholder with the file location/name and call it in [q]value="[[+tvname]]"[/q]

      When you’d do that, though, and submit the form, it will most likely attempt to upload a file from the users’ computer (which doesn’t exist), so I would just keep the file upload field empty, but instead display something like "Current file: [[+tvname]]" and using the field to upload a new one to replace it.

        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.