cancel
Showing results for 
Search instead for 
Did you mean: 

Detect file selection/upload/removal in workflow form

wadsok
Champ in-the-making
Champ in-the-making
I have workflow with file selection and I need to do something when there is more than zero files selected. Now I am doing this check in form validation after "start workflow" is pressed, but I would like to able to call function once file is added or removed. Any suggestions?
2 REPLIES 2

lementree
Champ on-the-rise
Champ on-the-rise
Hi,

in package-items.ftl add below lines to handle formChange.


<#assign parentFieldHtmlId=args.htmlid + "_assoc_packageItems">
<script type="text/javascript">//<![CDATA[
(function()
{
   YAHOO.Bubbling.on("formValueChanged",function(layer, args)
   {

      var g=args[1].eventGroup;
      if(args[1].eventGroup==null)return;
      if(args[1].eventGroup.id=='${parentFieldHtmlId}-cntrl')
      {
         
         if(args[1].selectedItems.length>0)
         {
            //items are there
                            node=args[1].selectedItems[0];
            
         }else{
                           //no items
                        }
         
      }
   });
   
   
})();
//]]></script>

wadsok
Champ in-the-making
Champ in-the-making
Edit: Thank you. Your suggestion works.