Hey, I'm creating a bulletin board application for my company, a user will be able to add a bulletin as well as a file. After, this will be entered into our SQL database in order for the bulletin board ticker to pick them up. I would like to test if the form input field for the file uploader is null. If it is, upload a file that I give it in the code, This is what I've tried but no joy so far -
function isFileNull()
{
if (document.getElementById('FTU').value == null)
{
document.getElementById('FTU').value = "http://dinoweb1.fhcdom.net/FHCIntranet/Bulletin%20board/NoFileUploaded.txt";
}
}
{
if (document.getElementById('FTU').value == null)
{
document.getElementById('FTU').value = "http://dinoweb1.fhcdom.net/FHCIntranet/Bulletin%20board/NoFileUploaded.txt";
}
}
Any ideas out there?
Thanks.
Riddhi ValechaPosted Sep 19, 2014, 5:08 AM
Instead of using Javascript validation, make a method in aspx.cs file.
Eg -
private String IsFileNull()
{
if(FTU.String() == null || FTU.String() == "")
return "FTU Must not be blank";
else
return null.
}
---------
In button_click event call this method-
Button_Click
{
if(IsFileNull() == null)
{
// rest of the code
}
}