File upload widget - validation rule

327 views
Skip to first unread message

Luigi

unread,
Jun 9, 2017, 10:52:00 AM6/9/17
to Fujitsu RunMyProcess Developer Community
Hello,
I have a File upload widget, set as NOT REQUIRED, with the validation rule below, to avoid, in case, an upload of duplicated names.

Anyway, even if I upload NO files, the "invalid value" msg appears and the process cannot be started by the submit button.

Is there anything I can check/verify ?

Thank you!
Luigi

********************************************************
/* TO CHECK IF FILES ARE UPLOADED TWICE */
var upload = [[attachments_others]];
var is_ok = true;
for (var i = 0; i<upload.length;i++){
for (var j = i+1; j<upload.length;j++){
if (upload[i].name.toLowerCase() == upload[j].name.toLowerCase()){
alert('File name: "' + upload[j].name + '" already uploaded.');
var is_ok = false;
break;
}
}
if (!is_ok){
break;
}
}
if (!is_ok){
false;
}
else{
********************************************************

Gunjan Rajgure

unread,
Jun 10, 2017, 6:03:17 AM6/10/17
to suppor...@runmyprocess.com, Luigi Cichella
Hello Luigi,

Actually we didn't get your query, can you please elaborate more your problem? And one more thing is, the File Upload widget is accepted only one file of same name at a time. No need to check manually for duplicate (by file name) uploaded file. Could you check that?


Please feel free to contact with us for any query.

Best Regards
Gunjan Rajgure
Fujitsu - RunMyProcess Support



--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/e39cb15b-23a5-4f0c-916a-18131c9763fc%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

Gunjan Rajgure

unread,
Jun 10, 2017, 6:55:12 AM6/10/17
to suppor...@runmyprocess.com, Luigi Cichella
Hello Luigi,

You can add this validation script inside JavaScript widget and use value variable of file upload widget to JS widget as "Listen To Variables". This script executed only when you select any file for upload. Whether you are select or not select any file to upload, it will not create any problem to proceed your process. 
Please find some Screen shots for more clarification.

If still facing any issue, please don't hesitate to contact with us.


Best Regards
Gunjan Rajgure
Fujitsu - RunMyProcess Support
upload_widget.JPG
Validation_script.JPG

Gunjan Rajgure

unread,
Jun 11, 2017, 1:06:16 PM6/11/17
to suppor...@runmyprocess.com, Luigi Cichella
Hello Luigi,

Could you please confirm that, provided solution fulfills your requirement?
Awaiting for your response.


Please don't hesitate to contact with us for any other query.

Best Regards
Gunjan Rajgure
Fujitsu - RunMyProcess Support
On Sat, Jun 10, 2017 at 4:25 PM, Gunjan Rajgure <gunjan....@runmyprocess.com> wrote:
Hello Luigi,

You can add this validation script inside JavaScript widget and use value variable of file upload widget to JS widget as "Listen To Variables". This script executed only when you select any file for upload. Whether you are select or not select any file to upload, it will not create any problem to proceed your process. 
Please find some Screen shots for more clarification.

If still facing any issue, please don't hesitate to contact with us.


Best Regards
Gunjan Rajgure
Fujitsu - RunMyProcess Support

Luigi

unread,
Jun 12, 2017, 5:25:35 AM6/12/17
to Fujitsu RunMyProcess Developer Community, ciche...@fatergroup.com
> To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
Hello Gunjan,
I tried again and the "file upload widget" check if the file is duplicated only if you try to upload exactly the same file, that is from the same path.
If you upload two with the same name from different paths, it will allow you.
A feature/property to prevent uploading identical file names from anywhere would be useful...
Anyway, if I undestood, there is a problem when I put a "validation rule" in the widget while the same is not "required", thus I should use a JS widget as you described to check the duplication: is it correct ?

Thank you!





Gunjan Rajgure

unread,
Jun 12, 2017, 2:43:45 PM6/12/17
to suppor...@runmyprocess.com, Luigi Cichella
Hello Luigi,

Yes, alternately you can try with JS widget to check duplication of file upload. If you check for validation rule, definitely it will not move forward until and unless you select any file in it. Better way, you can use JavaScript widget to solve problem whether file is added or not in upload widget.


Please feel free to contact with us for any other clarification.

Best Regards
Gunjan Rajgure
Fujitsu - RunMyProcess
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.

Luigi

unread,
Jun 13, 2017, 6:14:00 AM6/13/17
to Fujitsu RunMyProcess Developer Community, ciche...@fatergroup.com
Hello Gunjan,
using the JS widget to check duplication of file upload, does it change the JS script that is now in the validation rule of text input ?
I mean:
- how is triggered the result (true/false) in the JS widget to inhibit the submit of WI ?
- is it possible to put 2 file upload variable together in the JS script so that the duplication is checked wholly for both widget ?

Thank you,
Luigi

Abhilash Sambhare

unread,
Jun 14, 2017, 7:58:56 AM6/14/17
to Fujitsu RunMyProcess Developer Community, Luigi Cichella
Hi Luigi,

Using JS widget will not affect the Javascript in the validation rule of text widget.The best way to check the duplicate files in upload widget is to write the validation code into validation rule.It is possible to put two file upload variable into the same JS code but it will not have the desired functionality you want to implement.I have tried to implement the scenario,it is giving allowing me to upload duplicate files.So instead you can write separate JS code for both the upload widget and insert this code into validation rule.

Hope this helps you.Please don't hesitate to contact us for any further query.

Thanks & Regards,
Abhilash Sambhare
Fujitsu RunMyProcess Support



To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.

Luigi

unread,
Jun 16, 2017, 4:53:13 AM6/16/17
to Fujitsu RunMyProcess Developer Community, ciche...@fatergroup.com
Hi Abhilash,
thank you for information.
I solved by putting the code descrived in the validation rule of the upload widget "required".
However, I changed the code to check both upload widget array variable.

Thank you.
Reply all
Reply to author
Forward
0 new messages