Hi,I am unable to validate for mandatory attachment in a web application. I am using a file upload control, which is allowing the user to select the file and attach on submitting. but problem is before submitting, how to get the handle to the attachment to check whether user has attached or not., as @attachments doesn’t give me value before saving.
I even tried using tag instead, this is getting me to correctly validate the attachment however, the attachment is not saved with the document, if I use this.
Can anyone help me on this? or suggest any other method, as I am new to web.
Subject: Validating attachments on web - file upload control
On the HTML tab of the file upload control’s properties, enter an Id for the control. You can then get the filename of the selected file using the value property of the control. Example (“myuploadID” is the Id of the control):
Subject: Validating attachments on web - file upload control
Give an id to the File Upload Control properties under HTML tab say for eg: att. Then onSubmit do the following:
if (document.getElementById(“att”).value==“”) {
alert("Please attach")
return false;
}
Make sure the form properties “Generate HTML for all Fields” is checked. If you don’t want to generate HTML for all fields then you need to make sure that the file upload control is somehow available to javascript.
Subject: RE: Validating attachments on web - file upload control
What if the user manipulates the string in the file upload control or doesn’t use the Browse button at all, but enters the path manually (to a non-existing file)?
You can’t use client-side validation here. It has to be done in a WebQuerySave agent.