HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

Multiple Upload files with different names


#1

G’day,

I started using HelpSpot. I would like to add multiple uploads at the Request Form. I want one of them to be required and the other one to be optional. I added to uploads inputs easily but when I added the name=“doc[]” at the required script, the other upload inputs became required too. How to keep one upload field required and the other one optional.

/* REQUIRED SCRIPT */
< input type=“hidden” name=“required” value=“doc[]” / >

< p>< label for="doc[]" class="datalabel required">REQUIRED UPLOAD</label><br />
	< input type="file" name="doc[]" size="60"> // SAME NAME USED "doc[]" 
< /p>

< label for="doc[]" class="datalabel">OPTIONAL UPLOAD
< input type="file" name="doc[]" size="60"> // SAME NAME USED "doc[]"

How to keep the second upload to be optional

I hope my question is clear!

Thank you,


#2

Hi Rakan,
I know I already responded to you separately, but I thought I would post this out here in case anyone else happens across this.

I have worked out a way to achieve what you are looking for by simply using some independent validation javascript. Here is the complete example https://gist.github.com/mpstenson/5c01f3cff4f02a402a5a965426443679.

As you will note on the first field we add an ID of doc1 https://gist.github.com/mpstenson/5c01f3cff4f02a402a5a965426443679#file-request-tpl-php-L200.

Then we add some validation javascript https://gist.github.com/mpstenson/5c01f3cff4f02a402a5a965426443679#file-request-tpl-php-L1-L11

and finally call it during submit https://gist.github.com/mpstenson/5c01f3cff4f02a402a5a965426443679#file-request-tpl-php-L37. That should get you going!


#3

Thank you so much!. It’s working perfectly!.