File Fields not working

Hi…

I’m trying to use a file field in my form and, although it’s rendered properly, Camunda won’t enable the Complete button, no matter if this field is required or not.

<input type="file"
       cam-variable-name="PDF_INVOICE"
       cam-variable-type="File"
       cam-max-filesize="10000000"/>

As you can see my code is pretty much like the example in the documentation but I can’t make it work (I even removed the “required” attribute but made no difference).

I’m using a spring app with the engine embedded and had to configure some beans to make it all work… Is there any kind of configuration I should do or any restriction to make file fields work ?

Hi @fcordova,

the Complete button will be enabled, if you claim the task from the group list.

Does it help you?

Cheers, Ingo

Hi Ingo, thanks for your reply…

Actually, it’s not that the whole form is disabled (that happen when you haven’t claimed the task) but only the complete button.

Once I remove the field, everything works pretty fine.

Hi people, I really need some help here…

I created a really simple process with this form:

<form>
	<h1>Upload Test</h1>
	<div>
		<label>Invoice File</label><br>
		<input type="file"
	       cam-variable-name="INVOICE_DOCUMENT"
	       cam-variable-type="File"
	       cam-max-filesize="10000000" required/>
	</div>
</form>

And I can’t start the process because the Complete Button is not enabled.

Is there anything I have to configure to make it work ?

@fcordova, which version of Camunda BPM and which browser are you using? Are there any form fields in the form that may still need to be filled in before completion?

Cheers

Hi @Matthijs, thanks for your reply…

I’m using 7.7.0 (Downloaded, Tomcat version) and the form is exactly like the code I inserted above. Only the file field, nothing else.

The process definition has no delegate, no script, only the start, task and finish.

Hi guys…

Has anybody tried to simulate this problem or has a hint of what’s going on ? :disappointed_relieved:

Hi @fcordova,

I can reproduce your problem.
If you delete the “required” attribute from the input tag, the “complete” button is active.

Cheers,
kristin

2 Likes

Hi all

However, if you do require a file upload, ie it’s mandatory to upload a file, then the “required” attribute causes the Complete not to activate at all. How do you ensure the expected behavior of “required”. Note that “required” works as expected for all other input types.

Hi everyone!
I have same problem, do you have any info how to solve it?
Thanks in advance,
Mike

Hi, have the same Problem .

Hello,

Has anyone managed to solve this problem? I’m not able to proceed with the form when the file field is mandatory

Hello, if you need make required file input, try this workaround: 
    <form name="formName"
          class="form-horizontal"
          role="form">
        <script cam-script type="text/form-script">
             $scope.fileNotSelected = function(field) {
                return document.getElementById(field).value == '';
            };
        </script>
        <div class="form-group">
            <label class="control-label col-md-2" for="fileUpload">Try it</label>
            <div class="col-md-10">
                <input type="file"
                       id="fileUpload"
                       cam-variable-name="fileUpload"
                       cam-variable-type="File"
                       cam-max-filesize="10000000"
                       class="form-control"/>
            </div>
            <div>
                <input id="fileExists"
                       class="form-control"
                       type="hidden"
                       ng-model="fileExists"
                       ng-required="fileNotSelected('fileUpload')"
                />
            </div>
        </div>
    </form>