function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
springerwaspringerwa 

Visualforce Page that allows File Input to check a box

I would like to make a separate VF page with 3 file upload sections (Upload Document "A", Upload Document "B", Upload Document "C") or even just custom buttons name "Doc A", "Doc B", "Doc C" that when used to attach a file will mark a corresponding checkbox to checked:

Document "A" attached?   

Document "B" attached?   

Document "C" attached?   

 

We are having trouble with getting our staff to check the box after they have uploaded a "specific" document and it seems like I can bind that action into the act of uploading the attachment somehow...but I don't know where to begin or what the best methodology is for this.

 

Any suggestions? or examples of similar solutions?

bob_buzzardbob_buzzard

Its a little difficult to give specific help, as you don't specify what you are attaching these items to and if you want the persist the checkbox values against an object. 

 

Do you want the box to be checked prior to the attachment being loaded (e.g. after the file has been selected) or after the user has submitted back the form and actually attached the file?

 

As the latter makes more sense, I'm assuming its that!

 

These file uploads actually happen when the user submits the form back, and presumably bind to variables within your controller.  All you need to do is check if the variables contain data (i.e. the attachment name/body isn't null) when displaying the checkboxes.   

springerwaspringerwa

My apologies, it was a big vague.  I forget the board has not been banging their heads against the details like I have been *grin*.

 

The files must be attached to the Opportunity and as you correctly deduced, the checkbox would need to "check" after the user submits the form and the file is actually attached.

 

I would love it if the checkbox could update based on part of the filename but with my newbie status (I have only done an "update" visualforce page and one simple trigger) I figured I couldn't begin to tackle that one so I ended up with thinking I may be able to figure out how to make a separate "upload" button for each "type" of file and then tie that button action to updating the checkbox.

 

What the goal is to monitor the compliance of the sales staff - there must be 5 files attached to each opportunity.

  • Account Plan
  • ROI analysis
  • Quote request
  • Market analysis details
  • Market visual analysis powerpoint slide 

 

There are matching checkboxes:

  • Account Plan Uploaded?
  • ROI Uploaded?
  • Quote Req Uploaded?
  • Market Analysis Uploaded?
  • Market Chart Uploaded?

 

Unfortunately we have not had luck with anyone doing BOTH steps so we are trying to automate the process as we use those 5 checkboxes to assign a "grade" that rates completion per Opportunity then per Owner across all of their Opportunities.  A "naughty list" if you will *grin*

 

If anyone has a controller example of a file upload action checking a box that could get me started I would really appreciate it.  I will continue to search the boards for an existing example in the meantime.

 

Thanks!

bob_buzzardbob_buzzard

Assuming the following:

 

 

  • you have a VF component and controller attached to your opportunity page, or a dedicated VF page and controller.
  • When allowing users to upload files, you are using an apex inputFile component, backed by a property from your controller.
  • The checkboxes are fields on the opportunity.
  • The user clicks a save button that executes an action method to save the attachments.
 
So can you not change your action method to set the appropriate checkbox value on the opportunity if the appropriate attachment property contains data?