Could anyone spot my error in my code, i cannot do validation for my codes. im using eclipse, javascript and html

    <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    
    <link rel="stylesheet" type="text/css" href="css/index.css">
	<link rel="stylesheet" href="js/jquery.mobile-1.4.5.min.css">
	<script src="js/jquery-1.11.3.min.js"></script>
	<script src="js/jquery.mobile-1.4.5.min.js"></script>
	<script src="common.js"></script>
    <title>Hello World</title>
    <script>

function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}

    function getRadioValue(groupName) {
    	var _result;
    	try {
    	var o_radio_group = document.getElementsByName(groupName);
    	for (var a = 0; a < o_radio_group.length; a++) {
    	if (o_radio_group[a].checked) {
    	_result = o_radio_group[a].value;
    	break;
    	}
    	}
    	} catch (e) { }
    	return _result;
    	}

    function isInt(value) {
    	return !isNaN(value) &&
    	parseInt(Number(value)) == value &&
    	!isNaN(parseInt(value, 10));
    	}

    function calculateLoan(){
        var loanamount = parseFloat((document.loanform.loanamount.value)); 
        var interestrate = parseFloat(document.loanform.Interestrate.value); 
        var YearsofLoan = parseFloat(document.loanform.YearsofLoan.value);         
        var monthlyannually = getRadioValue("basisofinterest");         
        
        var Income=parseFloat(document.loanform.Income.value); 
        
        var a,b,c,d,e;
        a = interestrate/100;
        b = a*loanamount;
        c = (1+a);
        d = -(YearsofLoan*12);
        e = Math.pow(c,d);
        f = 1 - e;
        g = b/f;
       
        
        alert(g);
        
        
        
        }    
    
    if (validated(interestrate, basisofinterest, loanamount, YearsofLoan, Income)){

		
		localStorage.setItem("basisofinterest", basisofinterest);
		localStorage.setItem("Income", Income);	
		localStorage.setItem("loanamount", loanamount);
		localStorage.setItem("interestrate", interestrate);
		localStorage.setItem("YearsofLoan", YearsofLoan);
			document.loanform.submit();
		}
	}
	function validated(interestrate, basisofinterest, loanamount, YearsofLoan, Income){
			
			 if (loanamount == ""){
					alert("loanamount is required");
					$("#loanamount").focus();
					return false;
					}
			
			else if (interestrate == ""){
				alert("interestrate is required");
				$("#interestrate").focus();
				return false;
			}
			 
			 
			else if (basisofinterest == ""){
				alert("basisofinterest is required");
				$("#basisofinterest").focus();
				return false;
			}
				
			else if (YearsofLoan == ""){
				alert("YearsofLoan is required");
				$("#YearsofLoan").focus();
				return false;
				}
			else if (Income == ""){
				alert("Income is required");
				$("Income").focus();
				return false;
				}
		return true;
		}
		
		

    
    
    
    
    
    
    
    
    
    
    </script>
</head>

    
    
    
     <div data-role="main" class="ui-content">
Loan amount(in$):

Interest rate (in%):

Basis of interest Monthly Annually

Years of Loan:

Income:

    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.