html>
//Sujata 0013348: multiple document upload in web to lead
function dropdownSaveWithname(id,field,val){ }
$(document).ready(function() {
var max_fields = $('#max_file_upload_limit').val(); //maximum input boxes allowed
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_field_button"); //Add button ID
var x = 1; //initlal text box count
var y = $('#browse_count').val();
$(add_button).click(function(e){ //on add input button click
e.preventDefault();
if(y < max_fields){ //max input box allowed x++;//text box increment y = parseInt(y)+1; var file_content=''; var file_type_content = $('#file_type_content').val().split(','); $.each(file_type_content, function(i, val) { file_content += '';
});
$('#browse_count').val(y);
base_url = $('#base_url').val();
$(wrapper).append('
');
}
});
$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
// Anirban - 0013411: Please fix this issue
var dltconfirm = confirm("Are you sure you want to delete?");
if (dltconfirm == true) {
e.preventDefault(); $(this).parent('div').remove(); y=parseInt(y)-1;
$('#browse_count').val(y);
}
// 0013411 - End
})
//koushik: 13431: include template in web to leads
var req_fields_str = $('#req_id').val();
if(req_fields_str != ''){
req_fields_str = req_fields_str.substring(0,req_fields_str.lastIndexOf(';'));
var req_fields_arr = req_fields_str.split(';');
req_fields_arr.forEach(function(db_field_name, index){
$('#'+db_field_name+'_color').show();
});
}
//End 13431
});
//End 0013348
function validateUrl(){
var url_fld_id = $('.url').attr('id');
var url_value = $("#"+url_fld_id).val();
if(url_value && url_value != ''){
var url_filter= /^(http(?:s)?\:\/\/[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,4}(?:\/?|(?:\/[\w\-]+)*)(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$/
if(url_filter.test($("#"+url_fld_id).val())==false)
$("#"+url_fld_id).attr('placeholder','Valid url required,Ex.https://www.example.com').addClass('wrong');
if(url_filter.test(url_value)){
$("#"+url_fld_id).removeClass('wrong');
return true;
}else{
return false;
}
}else{
$("#"+url_fld_id).removeClass('wrong');
return true;
}
}
//Sujata 0013348: multiple document upload in web to lead
function getLibraryIdForDelete(library_id,field){
var content = $('#library_ids').val()+library_id+',';
$('#library_ids').val(content);
$('#div_'+field).html('');
}
//End 0013348
function validateNumeric(obj){
var numeric_value = obj.value;
if(isNaN(obj.value)){
var numeric_value = numeric_value.substr(0, numeric_value.length - 1);
numeric_value = numeric_value.replace(/[^0-9\.]/g, "");
}
$("#" + obj.id).val(numeric_value.trim());
}
function validWebLead(){
if(document.getElementById('email')){
$(function(){
var targetbox = document.getElementById('email');
targetbox.style.color="#5D5D5D";
targetbox.style.backgroundColor="#FFF";
targetbox.placeholder="";
});
if(validateEmail(document.getElementById('email').value)=="No") {
var targetbox = document.getElementById('email');
targetbox.style.backgroundColor="#FFE9E9";
targetbox.value="";
targetbox.placeholder="Enter a valid Mail Id";
targetbox.style.color="#FF5A5A";
targetbox.onfocus=function(){targetbox.style.color="#5D5D5D"; targetbox.style.backgroundColor="#FFF"; targetbox.placeholder="";};
return false;
}
}
if(document.getElementById('phone')){
$(function(){
var targetbox = document.getElementById('phone');
targetbox.style.color="#5D5D5D";
targetbox.style.backgroundColor="#FFF";
targetbox.placeholder="";
});
if((validatePhone(document.getElementById('phone'))=="No") && (document.getElementById('phone').value!="")) {
var targetbox = document.getElementById('phone');
targetbox.style.backgroundColor="#FFE9E9";
targetbox.value="";
targetbox.placeholder="Enter a valid Phone No.";
targetbox.style.color="#FF5A5A";
targetbox.onfocus=function(){targetbox.style.color="#5D5D5D"; targetbox.style.backgroundColor="#FFF"; targetbox.placeholder="";};
return false;
}
}
var req = true;
var req_any = true;
if(document.getElementById('req_id') != null){
var reqs=document.getElementById('req_id').value;
if(reqs != ''){
reqs = reqs.substring(0,reqs.lastIndexOf(';'));
var req_fields = new Array();
var req_fields = reqs.split(';');
nbr_fields = req_fields.length;
for(var i=0;i