how can live validation for attachment in form region.the following code put in global variable at page attribute and define the static ID as ATT1 in region.its not firing?
$('#ATT1').ready( function() {
//check whether browser fully supports all File API
if (window.File && window.FileReader && window.FileList && window.Blob)
{
//get the file size and file type from file input field as attachment Item
var fsize = $('#P4_NWM_DOC_FILE_BINARY')[0].files[0].size;
var ftype = $('#P4_NWM_DOC_FILE_BINARY')[0].files[0].type;
switch(ftype)
{
case 'image/pdf':
case 'image/jpeg':
alert("Acceptable image file!");
break;
default:
alert('Unsupported File!');
}
}
else{
alert("Please upgrade your browser, because your current browser lacks some new features we need!");
}
if(fsize>1048576) //do something if file size more than 1 mb (1048576)
{
alert(fsize +" bites\nToo big!");
}
else{
alert(fsize +" bites\nYou are good to go!");
}
else{
alert("Please upgrade your browser, because your current browser lacks some new features we need!");
}
}
);