This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jul 25, 2011, 8:10 AM
261 Posts

Re: File Upload control - stopping the choose file prompt

  • Category: Dojo and Client Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 2
Steven,
 
Sending a return false on the onClick event of a File Upload Control doesn't do anything. What you need to do is to stop the execution of the default event (showing the file browse dialog). Dojo has some handy functions to do so. Instead of "return false" you could call the function:
 
dojo.stopEvent(thisEvent);
 
(in a clientside Javascript function on an XPage, the "thisEvent" variable contains the current event)
 
See http://dojotoolkit.org/reference-guide/quickstart/events.html#quickstart-events for some more background info.
 
Mark
Jul 26, 2011, 3:58 AM
10 Posts
Re: File Upload control - stopping the choose file prompt
Spot on Mark, thanks. The field is now editable too so I've changed the .innerhtml to .value for anyone "borrowing" the code.
 

var photoFld = document.getElementById("#{id:inputPhoto1}").value;

if(photoFld == "" || photoFld == null) {

      alert("You cannot perform this operation until you have entered a description.");

      dojo.stopEvent(thisEvent);

 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal