<script type="text/javascript" lang="javascript">
function ValidatePage() {
var pageresult = true;
var Cname = document.getElementById('<%=txtCname.ClientID %>');
var spanCname = document.getElementById('rfvCname');
var NgoType = document.getElementById('<%=ddlNGOType.ClientID %>');
var spanNGOType = document.getElementById('rfvNGOType');
var checkEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var Email = document.getElementById('<%=txtEmail.ClientID %>');
var spanEmail = document.getElementById('rfvEmail');
var Address1 = document.getElementById('<%=txtAddressLine1.ClientID %>');
var spanAddress1 = document.getElementById('rfvAddressLine1');
var country = document.getElementById('<%=ddlCountry.ClientID %>');
var spanCountry = document.getElementById('rfvCountry');
var State = document.getElementById('<%=ddlState.ClientID %>');
var spanState = document.getElementById('rfvState');
var countries = document.getElementById('<%=drpCountries.ClientID %>');
var states = document.getElementById('<%=drpStates.ClientID %>');
if (jQuery.trim(Cname.value) == '') {
spanCname.style.display = 'inline';
spanCname.innerHTML = 'Required NGO Name';
pageresult = false;
}
else {
spanCname.innerHTML = '';
spanCname.style.display = 'none';
}
if (NGOType.selectedIndex == 0) {
spanNgoType.style.display = 'inline';
spanNgoType.innerHTML = 'Required Ngo Type ';
pageresult = false;
}
else {
spanCompanyType.innerHTML = '';
spanCompanyType.style.display = 'none';
}
if (jQuery.trim(Email.value) != '') {
if (!checkEmail.test(jQuery.trim(Email.value))) {
spanEmail.style.display = 'inline';
spanEmail.innerHTML = 'Required Valid Email';
pageresult = false;
//return true;
}
else {
spanEmail.style.display = 'none';
spanEmail.innerHTML = '';
}
}
if (jQuery.trim(Address1.value) == '') {
spanAddress1.style.display = 'inline';
spanAddress1.innerHTML = 'Required Address 1';
pageresult = false;
}
else {
spanAddress1.innerHTML = '';
spanAddress1.style.display = 'none';
}
if (country.selectedIndex == 0) {
spanCountry.style.display = 'inline';
spanCountry.innerHTML = 'Required Country';
pageresult = false;
}
else {
spanCountry.innerHTML = '';
spanCountry.style.display = 'none';
}
if (Region.value.toLowerCase() == "na" && State.selectedIndex == 0) {
spanState.style.display = 'inline';
spanState.innerHTML = 'Required State';
pageresult = false;
}
else {
spanState.innerHTML = '';
spanState.style.display = 'none';
}
// if (City.selectedIndex == 0 || City.options[City.selectedIndex].value != '') {
// spanCity.style.display = 'inline';
// spanCity.innerHTML = 'Required City';
// pageresult = false;
// }
if (countries.selectedIndex != 0) {
var result = '';
$('#' + countries.id + ' option:selected').each(function () {
result = result + $(this).val() + '|';
});
result = result.substring(0, result.length - 1);
document.getElementById('<%= hdnCountries.ClientID%>').value = result;
}
if (states.selectedIndex != 0) {
var result = '';
$('#' + states.id + ' option:selected').each(function () {
result = result + $(this).val() + '|';
});
result = result.substring(0, result.length - 1);
document.getElementById('<%= hdnStates.ClientID%>').value = result;
}
if (Region.selectedIndex == 0) {
spanRegion.style.display = 'inline';
spanRegion.innerHTML = 'Required Region';
pageresult = false;
}
else {
spanRegion.innerHTML = '';
spanRegion.style.display = 'none';
}
return pageresult;
}
</script>
<script type="text/javascript" lang="javascript">
function ValidateEmail() {
var checkEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var Email = document.getElementById('<%=txtEmail.ClientID %>');
var spanEmail = document.getElementById('rfvEmail');
if (jQuery.trim(Email.value) != '' && !checkEmail.test(jQuery.trim(Email.value))) {
spanEmail.style.display = 'inline';
spanEmail.innerHTML = 'Required Valid Email';
return false;
}
else {
spanEmail.innerHTML = '';
spanEmail.style.display = 'none';
return true;
}
}
function ValidateDCity() {
var City = document.getElementById('<%=ddlCity.ClientID %>');
var spanCity = document.getElementById('rfvCity');
var OtherCity = document.getElementById('<%=txtCity.ClientID %>');
var DivOtherCity = document.getElementById('<%=divOtherCity.ClientID %>');
if (City.options[City.selectedIndex].value == '0') {
DivOtherCity.style.display = 'none';
spanCity.style.display = 'inline';
spanCity.innerHTML = 'Required City';
return false;
}
else {
if (City.options[City.selectedIndex].value == 'Other') {
DivOtherCity.style.display = 'block';
}
else {
OtherCity.value = "";
DivOtherCity.style.display = 'none';
}
spanCity.innerHTML = '';
spanCity.style.display = 'none';
return true;
}
}
function ValidateTCity() {
var City = document.getElementById('<%=txtCity.ClientID %>');
var spanCity = document.getElementById('rfvCity');
if (City.value == '') {
spanCity.style.display = 'inline';
spanCity.innerHTML = 'Enter valid city';
return false;
}
else {
spanCity.innerHTML = '';
spanCity.style.display = 'none';
return true;
}
}
</script>
<script type="text/javascript">
function setupLabel() {
if ($('.label_check input').length) {
$('.label_check').each(function () {
$(this).removeClass('c_on');
});
$('.label_check input:checked').each(function () {
$(this).parent('label').addClass('c_on');
});
};
if ($('.label_radio input').length) {
$('.label_radio').each(function () {
$(this).removeClass('r_on');
});
$('.label_radio input:checked').each(function () {
$(this).parent('label').addClass('r_on');
});
};
};
$(document).ready(function () {
$('.label_check, .label_radio').click(function () {
setupLabel();
});
setupLabel();
});
</script>
No comments:
Post a Comment