#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Javascript is executing in J1.5 but not in 2.5


    Below Javascript works pretty well when using joomla 1.5 php 5.3, but does not work on joomla 2.5 php 5.3 -

    Actually when the compute button is pressed - it does not validate the form . This seems a validation not happening

    any suggestion, have tried many times but not able to make it workd up !!


    <table width="71%" height="319" border="0" cellpadding="0" cellspacing="4">

    <tr>
    <td align="right" class="text3"><font color="#B60205"><small text>Salary:</font></td>
    <td class="text3">&nbsp;</td>
    <td class="text3"><input type="text" name="income" size="30" /></td>
    </tr>
    <tr>
    <td align="right" class="text3"><font color="#B60205"><small text>Add On : </font></td>
    <td class="text3">&nbsp;</td>
    <td class="text3"><input type="text" name="Coapplnincome" size="30" /></td>
    </tr>
    <tr>
    <td align="right" class="text3"><font color="#B60205"><small text>Deductions : </font></td>
    <td class="text3">&nbsp;</td>
    <td class="text3"><input type="text" name="OtherLonAmt" size="30"/></td>
    </tr>
    <tr>
    <tr>
    <td align="right" class="text3"><font color="#B60205"><small text>More Deductions:</font></td>
    <td class="text3">&nbsp;</td>
    <td class="text3"><input type="text" name="deduct" size="30"/></td>
    </tr>

    <td align="right" class="text3"><font color="#B60205"><small text>Rate (%): </font></td>
    <td class="text3">&nbsp;</td>
    <td class="text3"><input type="text" name="IntRate" size="30" /></td>
    </tr>
    <tr>
    <td align="right" class="text3"><font color="#B60205"><small text>Tenor : </font></td>
    <td class="text3">&nbsp;</td>
    <td class="text3"><input type="text" name="LoanTenure" size="30"/></td>
    </tr>
    <tr>
    <td align="right" class="formText">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td align="right" class="formText">&nbsp;</td>
    <td>&nbsp;</td>
    <td><input name="calc" type="button" class="red-btn" onClick="javascript:return(validate())" style="width:65" value="Compute" />
    <input type="reset" name="reset" value="Reset" class="red-btn" /></td>
    </tr>
    <tr>
    <td align="right" class="text3"><font color="#B60205"><small text>Elig </font> </td>
    <td>&nbsp;</td>
    <td><strong><big><input type="text" name="ElgibleLon" size="30" /></big></strong>
    </td>
    </tr>
    </table>
    </form></td>

    </div></td>
    </tr>
    </table>

    </br>

    </td>
    </tr>

    </tr>
    <br></br>



    <script type="text/javascript">

    function validate()

    {

    var income,Coapplnincome,vOtherLonAmt,deduct,IntRate,LoanTenure;

    var totInterest,totemi,ElgibleLon;

    if(!document.eligib_calc.income.value)

    {

    alert("Please enter Applicants gross monthy income");

    document.eligib_calc.income.focus();

    return false;

    }

    if(isNaN(document.eligib_calc.income.value))

    { alert("Please Enter Numeric value for Income");

    document.eligib_calc.income.focus();

    return false;

    }

    if(!document.eligib_calc.Coapplnincome.value)

    document.eligib_calc.Coapplnincome.value=0;

    else if(isNaN(document.eligib_calc.Coapplnincome.value))

    { alert("Please Enter Numeric value for Co applicant Income");

    document.eligib_calc.Coapplnincome.focus();

    return false;

    }



    if(!document.eligib_calc.OtherLonAmt.value)

    document.eligib_calc.OtherLonAmt.value=0;

    else if(isNaN(document.eligib_calc.OtherLonAmt.value))

    { alert("Please Enter Numeric value for other loans");

    document.eligib_calc.OtherLonAmt.focus();

    return false;

    }



    if(!document.eligib_calc.deduct.value)

    document.eligib_calc.deduct.value=0;

    else if(isNaN(document.eligib_calc.deduct.value))

    { alert("Please Enter Numeric value for Deductions");

    document.eligib_calc.deduct.focus();

    return false;

    }

    if(!document.eligib_calc.IntRate.value)

    {

    alert("Please enter Interest Rate(in %)");

    document.eligib_calc.IntRate.focus();

    return false;

    }

    if(isNaN(document.eligib_calc.IntRate.value))

    { alert("Please Enter Numeric value for Interest Rate(in %)");

    document.eligib_calc.IntRate.focus();

    return false;

    }



    if(!document.eligib_calc.LoanTenure.value)

    {

    alert("Please enter Loan Tenure");

    document.eligib_calc.LoanTenure.focus();

    return false;

    }

    if(isNaN(document.eligib_calc.LoanTenure.value))

    { alert("Please Enter Numeric value for Loan Tenure");

    document.eligib_calc.LoanTenure.focus();

    return false;

    }





    income=document.eligib_calc.income.value;

    Coapplnincome=document.eligib_calc.Coapplnincome.value;

    OtherLonAmt=document.eligib_calc.OtherLonAmt.value;

    deduct=document.eligib_calc.deduct.value;

    IntRate=document.eligib_calc.IntRate.value;

    LoanTenure=document.eligib_calc.LoanTenure.value;



    totInterest=(parseInt(income)+parseInt(Coapplnincome))-(parseInt(OtherLonAmt)+parseInt(deduct));

    totemi=EMI(100000,document.eligib_calc.IntRate.value,document.eligib_calc.LoanTenure.value);

    ElgibleLon=(totInterest*(0.4)/(totemi));

    //document.eligib_calc.emi.value=Math.ceil(totemi)+" per Lakh";



    ElgibleLon=ElgibleLon*100;

    ElgibleLon=Math.round(ElgibleLon);

    ElgibleLon=ElgibleLon/100;

    document.eligib_calc.ElgibleLon.value=ElgibleLon+" Lakhs";

    }



    function EMI(vAmt,IntRate,LoanTenure)

    {

    var terms;

    var numAmt,denAmt;

    var emiv;

    terms=12;



    numAmt=vAmt*Math.pow((1+IntRate/(terms*100)),LoanTenure);



    denAmt=100*terms*(Math.pow((1+IntRate/(terms*100)),LoanTenure)-1)/IntRate;



    emiv=12*(numAmt/(denAmt*12));



    emiv=Math.round(emiv);



    return emiv;



    }

    </script>
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0
    can someone advise pls.... Its critical

IMN logo majestic logo threadwatch logo seochat tools logo