# Optional Document Upload

**URL:** <https://community.ofelia.com/t/optional-document-upload/6952>\
**Category:** Q&A\
**Created:** [11 February 2016 10:37 UTC](https://community.ofelia.com/t/optional-document-upload/6952 "2016-02-11T10:37:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkcuyler](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@pkcuyler](https://community.ofelia.com/u/pkcuyler)\
**Post date:** [11 February 2016 10:37 UTC](https://community.ofelia.com/t/optional-document-upload/6952/1 "2016-02-11T10:37:57Z")

</div>

Hi

Im using Bonita 7.1

I would like to know if there is a way to have an optional document upload?

I have a form with 10 document upload widgets, some times we need all 10 sometimes only 2, they cant be part of the contract because I might not use them and then the contract will not be for filled, so i cannot submit.

Any idea what is the best way to do this?

Regards  
Paul

---

<div class="post-metadata">

**Author:** ![tresnjica93\_1](https://avatars.discourse-cdn.com/v4/letter/t/e68b1a/32.png) [@tresnjica93\_1](https://community.ofelia.com/u/tresnjica93_1)\
**Post date:** [11 February 2016 12:08 UTC](https://community.ofelia.com/t/optional-document-upload/6952/2 "2016-02-11T12:08:44Z")

</div>

Hello  
In Bonita 6.x forms, in the Options menu of the file button, you should check/uncheck **Is mandatory** check box. That way, the user can choose whether to or not to add a file. There should be a similar option for Bonita 7.x as well. You can make documents as pool variables and work with them as such. Is that what you were looking for?  
Best regards.

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [11 February 2016 13:00 UTC](https://community.ofelia.com/t/optional-document-upload/6952/3 "2016-02-11T13:00:30Z")

</div>

Contracts accept NULL as a valid value so you just have to pre-assign a NULL value and it will work the way you want.

Have a look here: [http://community.ofelia.com/node/22206#node-22215](http://community.ofelia.com/node/22206#node-22215)

regards  
Seán

_PS: If this post solves your question, please mark as Resolved._

---

<div class="post-metadata">

**Author:** ![vivek.paranthaman](https://avatars.discourse-cdn.com/v4/letter/v/cdc98d/32.png) [@vivek.paranthaman](https://community.ofelia.com/u/vivek.paranthaman)\
**Post date:** [11 February 2016 12:10 UTC](https://community.ofelia.com/t/optional-document-upload/6952/4 "2016-02-11T12:10:12Z")

</div>

Hi,

You may have to dig deep in [ng-hide](https://docs.angularjs.org/api/ng/directive/ngHide)

inorder to get an idea of the required, however, you have to understand the custom page option in bonita aswell, you can research more in [link] …  
[link]: [http://documentation.bonitasoft.com/custom-widgets](http://documentation.bonitasoft.com/custom-widgets)

Regards,  
Vivek

---

<div class="post-metadata">

**Author:** ![pkcuyler](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@pkcuyler](https://community.ofelia.com/u/pkcuyler)\
**Post date:** [11 February 2016 12:29 UTC](https://community.ofelia.com/t/optional-document-upload/6952/5 "2016-02-11T12:29:20Z")

</div>

Hi vivek.paranthaman

Thanks for the info is there no workaround as I’m not very good at angular?

Is there no way to push from the form to the “document” without going through a contract?

Regards  
Paul

---

<div class="post-metadata">

**Author:** ![pkcuyler](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@pkcuyler](https://community.ofelia.com/u/pkcuyler)\
**Post date:** [11 February 2016 12:22 UTC](https://community.ofelia.com/t/optional-document-upload/6952/6 "2016-02-11T12:22:22Z")

</div>

Hi tresnjica93

Bonita 7 Ui designer works on contract and api it does not seem to have that option

Regards  
Paul

---

<div class="post-metadata">

**Author:** ![pkcuyler](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@pkcuyler](https://community.ofelia.com/u/pkcuyler)\
**Post date:** [12 February 2016 06:15 UTC](https://community.ofelia.com/t/optional-document-upload/6952/7 "2016-02-12T06:15:32Z")

</div>

Hi Sean McP

Thanks this does look like it will work but how do i pre-assign the null value?

Do i do it on the form input side because when i do that  
Json  
“takeFive” : {}, \This one will allow the upload of the doc  
“unitDownload1” : null, \this one allows me to fore fill the contract with no document

I need a combination of the both  
On the form output side  
JavaScript exp  
I have tried an if statement but cant seem to get that to work?

Regards  
Paul
