Step 1:
Create
a File browse item.
a File browse item.
Step 2:
Create
a button to submit the page. Give the Action when Clicked as Defined by Dynamic
Action.
a button to submit the page. Give the Action when Clicked as Defined by Dynamic
Action.
Step 3:
Create
a Dynamic Action with execution of JavaScript as
a Dynamic Action with execution of JavaScript as
function
validateEstimation() {
validateEstimation() {
var IsValid = true;
var
estimate_file=$(“#P13_ESTIMATE_FILE”).val().trim();
estimate_file=$(“#P13_ESTIMATE_FILE”).val().trim();
if (IsValid) {
var exist_file= “”;
if($(“#P13_DOWNLOAD_FILE”).length
> 0) exist_file = $(“#P13_DOWNLOAD_FILE”).html();
> 0) exist_file = $(“#P13_DOWNLOAD_FILE”).html();
if (estimate_file == “”
&& exist_file == “”) {
&& exist_file == “”) {
IsValid
= false;
= false;
alert(“Please select
estimate file.”);
estimate file.”);
}
else if (estimate_file
!=””)
!=””)
{
estimate_file = estimate_file.substring(estimate_file.lastIndexOf(“.”));
//alert(estimate_file);
var allowedFormats =
“|.pdf|.xls|.doc|.xlsx|.docx|”;
“|.pdf|.xls|.doc|.xlsx|.docx|”;
if
(allowedFormats.indexOf(“|” + estimate_file + “|”) == -1) {
(allowedFormats.indexOf(“|” + estimate_file + “|”) == -1) {
IsValid = false;
alert(“Invalid
Estimate file format selected.”);
Estimate file format selected.”);
$(“#P13_ESTIMATE_FILE”).val(”);
}
}
if (!IsValid) return false;
}
}
This
Java Script function helps to accept .pdf,.xls,.doc,.xlsx,.docx files.
Java Script function helps to accept .pdf,.xls,.doc,.xlsx,.docx files.
By
A.Arun Kumar
Recent Posts