This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Remove file to be uploaded


  1. isak
    Member

    If someone selects a file to upload from their computer, then decides they do not want to upload a file, is there a way they can remove/delete their choice before they submit the form?

    Posted 14 years ago #
  2. redityo

    Hi,

    You can add a custom clear button beside "file upload" field. To do so, you need to edit "includes/view-functions.php" file. Go to around line 127, you will see these code :

    <input id="element_{$element->id}" name="element_{$element->id}" class="element file" type="file" />

    put these code exactly bellow that line

    <input id="reset" type="button" onclick="javascript:clearFileInputField('li_{$element->id}');" value="Clear" />

    Then, go to line 1834, you will see this code :

    {$calendar_js}

    put these code bellow that line

    <script type="text/javascript">
    
    function clearFileInputField(tagId)
    { document.getElementById(tagId).innerHTML = document.getElementById(tagId).innerHTML; } 
    
    </script>

    MachForm Support

    Posted 14 years ago #
  3. neilo
    Member

    Nice one - this should be a 'sticky'!

    Posted 14 years ago #

RSS feed for this topic

Reply