INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

HANDLE


PASSWORD
Remember Me
Forgot Password?

Come Join Us!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • Turn Off Ad Banners
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

E-mail*
Handle

Password
Verify P'word
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Member Feedback

"...Thank you. It's already helped me greatly, and I enjoy just reading the inputs from the other members..."

Geography

Where in the world do Tek-Tips members come from?
rockyroad (Programmer)
3 Jan 04 16:16
Hello, and thanks in advance.

I have the following problem. I have a validation script as such (the function is actually longer, however, I have only included the part of script and form that is giving me the problem)

<script language="JavaScript">
function validateForm(thisform){
    if(thisform.SecondMortgage[0].checked==true){
        {
        if(thisform.SecondMortgageBalance.value=='')
        alert('You must enter your current second mortgage balance.');
        return false;
        }
    }
    if(thisform.SecondMortgage[0].checked==true){
        {
        if(thisform.SecondMortgagePayment.value=='')
        alert('You must enter your current second mortgage payment.');
        return false;
        }
    }
    }
</script>


<form method="POST" action="refinanceform_action.cfm" name="newhome_form" onSubmit="return validateForm(this)">
                                          <table width="98%" cellpadding="0" cellspacing="1" bgcolor="000066">
                            <tr>
                              <td><table width="100%" cellpadding="6" cellspacing="0" bgcolor="#FFFFFF">
                                  <tr>
                                    <td width="253" align="right" class="darkBlue8pt">Do
                                      you have a second mortgage?</td>
                                    <td width="1"> </td>
                                    <td width="210"><table border="0" cellpadding="0" cellspacing="0" class="darkBlue10pt">
                                        <tr>
                                          <td width="55"><input type="radio" value="1" name="SecondMortgage" CHECKED>
                                            Yes</td>
                                          <td><input type="radio" value="0" name="SecondMortgage">
                                            No</td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">If you
                                      have a 2nd mortgage, what is the current
                                      balance?</td>
                                    <td> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" size="8" maxlength="8" name="SecondMortgageBalance" value="">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">If you
                                      have a 2nd mortgage, how much is the monthly
                                      payment?</td>
                                    <td> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" size="8" maxlength="8" name="SecondMortgagePayment" value="">
                                    </td>
                                  </tr>
                                  <tr align="center">
                                    <td colspan="3" bgcolor="#000066" class="darkBlue8pt"><font color="#FFFFFF">The
                                      following questions must be answered by
                                      all applicants.</font></td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="right" class="darkBlue8pt"><img src="images/blue_rule.gif" width="100%" height="1"></td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="right" class="darkBlue8pt"> </td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="right" class="darkBlue8pt"><img src="images/blue_rule.gif" width="100%" height="1"></td>
                                  </tr>
                                  <tr align="center">
                                    <td colspan="3" class="darkBlue8pt"> <input name="Submit" type="submit" class="Button2" value="Submit">
                                         <input name="Submit2" type="reset" class="Button2" value="Reset"></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt"> </td>
                                    <td> </td>
                                    <td> </td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table>
                        </form>

When I run this, I get no error. However, if I fill in the value in the first form field and try to submit, the page WILL NOT submit... just hangs there. Any ideas?
Thanks!
RR
theboyhope (IS/IT--Management)
3 Jan 04 17:02
Just syntax errors in your code, mate.

Watch it with the { }


function validateForm(thisform){

    if(thisform.SecondMortgage[0].checked==true) {

        if(thisform.SecondMortgageBalance.value=='') {
          alert('You must enter your current second mortgage balance.');
          return false;
        }
    }

    if(thisform.SecondMortgage[0].checked==true){

        if(thisform.SecondMortgagePayment.value=='') {
          alert('You must enter your current second mortgage payment.');
          return false;
        }
    }
}


Why check that SecondMortgage[0] is checked twice btw?
theboyhope (IS/IT--Management)
3 Jan 04 17:03

That last bit's a hint, not a genuine question. :)
LV (Programmer)
3 Jan 04 17:09
Just by looking at it, seems that you have your brackets in wrong places:

<script language="JavaScript">
function validateForm(thisform){
  if(thisform.SecondMortgage[0].checked){
    if(thisform.SecondMortgageBalance.value==''){
        alert('You must enter your current second mortgage balance.');
        return false;
     }
   }

   if(thisform.SecondMortgage[0].checked){        
     if(thisform.SecondMortgagePayment.value==''){
        alert('You must enter your current second mortgage payment.');
        return false;
      }
    }
}
</script>

See if this will fix it.
Lrnmore (TechnicalUser)
3 Jan 04 17:26
Howdy everyone,

Does it need a return true if all the tests are passed??

return true;
} //last curly

Great Javascript Resource:
http://devedge.netscape.com/library/manuals/2000/javasc...

rockyroad (Programmer)
3 Jan 04 17:37
OK The solutions you sent me worked, but unfortunately when I applied this to the entire validation, I had the same problem again.. please help! I know I am probably missing something simple!!!

THANKS EVERYONE FOR ALL YOUR HELP!!!!

<script language="JavaScript">
function validateForm(thisform){
    if(thisform.RefinanceExtraCash.value==''){
        alert('You must enter the value of extra cash desired.');
        return false;
    }
    if(thisform.CurrentHomeValue.value==''){
        alert('You must enter your current home value.');
        return false;
    }
    if(thisform.FirstMortBalance.value==''){
        alert('You must enter the balance of your first mortgage.');
        return false;
    }
    if(thisform.CurrentMonthPayment.value==''){
        alert('You must enter your current monthly payment amount.');
        return false;
    }
    if(thisform.CurrentInterestRate.value==''){
        alert('You must enter your current interest rate.');
        return false;
    }
    if(thisform.SecondMortgage[0].checked==true){
        {
        if(thisform.SecondMortgageBalance.value=='')
        alert('You must enter your current second mortgage balance.');
        return false;
        }
    }
    if(thisform.SecondMortgage[0].checked==true){
        {
        if(thisform.SecondMortgagePayment.value=='')
        alert('You must enter your current second mortgage payment.');
        return false;
        }
    }
    if(thisform.GrossIncome.value==''){
        alert('You must enter your Gross Annual Income.');
        return false;
    }
    if(thisform.DebtCreditCard.value==''){
        alert('You must enter your monthly credit card debt.');
        return false;
    }
    if(thisform.DebtMonthTotal.value==''){
        alert('You must enter your monthly debt payments.');
        return false;
    }
    if(thisform.FirstName.value==''){
        alert('You must enter your first name.');
        return false;
    }
    if(thisform.LastName.value==''){
        alert('You must enter your last name.');
        return false;
    }
    if(thisform.Email.value==''){
        alert('You must enter your email address.');
        return false;
    }
    if (thisform.Email.value.indexOf("@")==-1 || thisform.Email.value.indexOf(".")==-1 || thisform.Email.value.indexOf(" ")!=-1 || thisform.Email.value.length < 6){
        alert("Sorry, your email address is not valid.");
        thisform.Email.focus();
        return false;
    }
    if(thisform.Address.value==''){
        alert('You must enter an address.');
        return false;
        }
    if(thisform.City.value==''){
        alert('You must enter a city.');
        return false;
    }
    if(thisform.State.value==''){
        alert('You must enter a state.');
        return false;
    }
    if(thisform.Zip.value=='' | thisform.Zip.length<5){
        alert('You must enter a zip.');
        return false;
    }
    if(!numeric(thisform.Zip.value)){
        alert('You must enter a numeric zip');
        return false;
    }
    if(thisform.WorkPhone.value==''){
        alert('You must enter a Work Phone number.');
        return false;
    }
    if(thisform.HomePhone.value==''){
        alert('You must enter a Home Phone number.');
        return false;
    }
    if(thisform.SSNum.value=='' | thisform.SSNum.length<9){
        alert('You must enter a Social Security Number.');
        return false;
    }
    if(!numeric(thisform.SSNum.value)){
        alert('You must enter a numeric Social Security Number');
        return false;
    }
    if(thisform.BestTime.selectedIndex==0){
        alert('You must choose a Best Time to Contact.');
        return false;
    }
     if(thisform.CoFirstName.value==''){
        alert('You must enter coborrower first name.');
        return false;
    }
     if(thisform.CoLastName.value==''){
        alert('You must enter coborrower last name.');
        return false;
    }
    if(thisform.CoSSNum.value=='' | thisform.CoSSNum.length<9){
        alert('You must enter coborrower Social Security Number.');
        return false;
    }
    if(!numeric(thisform.CoSSNum.value)){
        alert('You must enter a numeric value coborrower social Security Number');
        return false;
    }
    return true;
}
function numeric(val){
    temp = true;
    for (i=0;i<val.length;i++){
        if(!(val.charAt(i)>='0' & val.charAt(i)<='9') & !(val.charAt(i)<='-') & !(val.charAt(i)<=' ')){
            temp = false;
        }
    }
    return temp;
}
</script>

<form method="POST" action="refinanceform_action.cfm" name="newhome_form" onSubmit="return validateForm(this)">
                          <input type="Hidden" name="FormType" value="2">
                          <table width="98%" cellpadding="0" cellspacing="1" bgcolor="000066">
                            <tr>
                              <td><table width="100%" cellpadding="6" cellspacing="0" bgcolor="#FFFFFF">
                                  <tr align="left">
                                    <td colspan="3" class="darkBlue8pt">    Which
                                      mortgage(s) would you like to refinance?
                                    </td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="right" class="darkBlue8pt"><table width="98%" cellspacing="0" cellpadding="5">
                                        <tr class="darkBlue8pt">
                                          <td width="31%"> </td>
                                          <td width="6%" valign="top"> <input type="radio" value="1st" name="RefinanceMortgageType" CHECKED></td>
                                          <td width="63%"> My 1st mortgage</td>
                                        </tr>
                                        <tr class="darkBlue8pt">
                                          <td> </td>
                                          <td valign="top"> <input type="radio" value="2nd" name="RefinanceMortgageType"></td>
                                          <td>My 2nd mortgage</td>
                                        </tr>
                                        <tr class="darkBlue8pt">
                                          <td> </td>
                                          <td valign="top"> <input type="radio" value="1st and 2nd" name="RefinanceMortgageType"></td>
                                          <td> My 1st and 2nd mortgages</td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="right" class="darkBlue8pt"><img src="images/blue_rule.gif" width="100%" height="1"></td>
                                  </tr>
                                  <tr>
                                    <td width="253" align="right" class="darkBlue8pt">What
                                      is your primary goal?</td>
                                    <td width="1"> </td>
                                    <td width="210"><select name="RefinanceGoal" size="1">
                                        <option value="Reduce My Monthly Payment" selected >Reduce
                                        My Monthly Payment</option>
                                        <option value="Reduce My Mortgage Term" >Reduce
                                        My Mortgage Term</option>
                                        <option value="Receive Cash at Closing" >Receive
                                        Cash at Closing</option>
                                      </select></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">How
                                      much cash do you want to take out of the
                                      property, over and above the balance of
                                      the loan?</td>
                                    <td width="1"> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" name="RefinanceExtraCash" value="" size="8" maxlength="10"></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">What
                                      type of home are you refinancing?</td>
                                    <td width="1"> </td>
                                    <td><select name="CurrentHomeType" size="1">
                                        <option value="Primary - Single Family" selected >Primary
                                        - Single Family</option>
                                        <option value="Primary - Condo" >Primary
                                        - Condo</option>
                                        <option value="Primary - Mobile Home" >Primary
                                        - Mobile Home</option>
                                        <option value="Primary - Townhome" >Primary
                                        - Townhome</option>
                                        <option value="2nd Home - Condo" >2nd
                                        Home - Condo</option>
                                        <option value="2nd Home - Mobile Home" >2nd
                                        Home - Mobile Home</option>
                                        <option value="2nd Home - Single Family" >2nd
                                        Home/Vacation - Single Family</option>
                                        <option value="2nd Home - Townhome" >2nd
                                        Home - Townhome</option>
                                        <option value="Investment - Condo" >Investment
                                        - Condo</option>
                                        <option value="Investment - Mobile Home" >Investment
                                        - Mobile Home</option>
                                        <option value="Investment - Townhome" >Investment
                                        - Townhome</option>
                                      </select></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">When
                                      did you purchase it?</td>
                                    <td width="1"> </td>
                                    <td> <table border="0" cellpadding="0" cellspacing="0" bgcolor="f7f7f7">
                                        <tr>
                                          <td><select name="CurrentHomePurchMonth" size="1">
                                              <option value="1" selected >January</option>
                                              <option value="2" >February</option>
                                              <option value="3" >March</option>
                                              <option value="4" >April</option>
                                              <option value="5" >May</option>
                                              <option value="6" >June</option>
                                              <option value="7" >July</option>
                                              <option value="8" >August</option>
                                              <option value="9" >September</option>
                                              <option value="10" >October</option>
                                              <option value="11" >November</option>
                                              <option value="12" >December</option>
                                            </select></td>
                                          <td>  </td>
                                          <td> <select name="CurrentHomePurchDay" size="1">
                                              <option value=1 selected>1</option>
                                              <option value=2>2</option>
                                              <option value=3>3</option>
                                              <option value=4>4</option>
                                              <option value=5>5</option>
                                              <option value=6>6</option>
                                              <option value=7>7</option>
                                              <option value=8>8</option>
                                              <option value=9>9</option>
                                              <option value=10>10</option>
                                              <option value=11>11</option>
                                              <option value=12>12</option>
                                              <option value=13>13</option>
                                              <option value=14>14</option>
                                              <option value=15>15</option>
                                              <option value=16>16</option>
                                              <option value=17>17</option>
                                              <option value=18>18</option>
                                              <option value=19>19</option>
                                              <option value=20>20</option>
                                              <option value=21>21</option>
                                              <option value=22>22</option>
                                              <option value=23>23</option>
                                              <option value=24>24</option>
                                              <option value=25>25</option>
                                              <option value=26>26</option>
                                              <option value=27>27</option>
                                              <option value=28>28</option>
                                              <option value=29>29</option>
                                              <option value=30>30</option>
                                              <option value=31>31</option>
                                            </select></td>
                                          <td>  </td>
                                          <td> <select name="CurrentHomePurchYear" size="1">
                                              <option value=2003>2003</option>
                                              <option value=2004 SELECTED>2004</option>
                                            </select></td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">What
                                      is the estimated value of your home?</td>
                                    <td> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" name="CurrentHomeValue" value="" size="8" maxlength="10"></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">What
                                      mortgage term are you looking for?</td>
                                    <td width="1"> </td>
                                    <td><select name="NewLoanType" size="1">
                                        <option value="30 Year Fixed" selected>30
                                        Year Fixed</option>
                                        <option value="20 Year Fixed">20 Year
                                        Fixed</option>
                                        <option value="15 Year Fixed">15 Year
                                        Fixed</option>
                                        <option value="10 Year Fixed">10 Year
                                        Fixed</option>
                                        <option value="30 Year Adjustable">30
                                        Year Adjustable</option>
                                        <option value="15 Year Adjustable">15
                                        Year Adjustable</option>
                                        <option value="1 Year ARM">1 Year ARM</option>
                                        <option value="3 Year ARM">3 Year ARM</option>
                                        <option value="5 Year ARM">5 Year ARM</option>
                                        <option value="7 Year ARM">7 Year ARM</option>
                                        <option value="10 Year ARM">10 Year ARM</option>
                                        <option value="5 Year Balloon">5 Year
                                        Balloon</option>
                                        <option value="7 Year Balloon">7 Year
                                        Balloon</option>
                                        <option value="Other">Other</option>
                                      </select></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">The
                                      loan balance on your 1st Mortgage is:</td>
                                    <td width="1"> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" name="FirstMortBalance" value="" size="8" maxlength="10"></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">What
                                      is your current monthly payment?</td>
                                    <td width="1"> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" name="CurrentMonthPayment" value="" size="8" maxlength="10"></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">What
                                      is your current interest rate?</td>
                                    <td width="1"> </td>
                                    <td><input type="text" size="8" maxlength="8" name="CurrentInterestRate" value="">
                                      <span class="darkBlue8pt"><strong>%</strong></span></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Your
                                      current mortgage term is:</td>
                                    <td width="1"> </td>
                                    <td><select name="CurrentMortTerm" size="1">
                                        <option value="30 Year Fixed" selected >30
                                        Year Fixed</option>
                                        <option value="30 Year Adjustable" >30
                                        Year Adjustable</option>
                                        <option value="15 Year Fixed" >15 Year
                                        Fixed</option>
                                        <option value="15 Year Adjustable" >15
                                        Year Adjustable</option>
                                        <option value="Other" >Other</option>
                                      </select></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Is your
                                      current mortgage a <a href="#" onclick="NewWindow(this.href,'editwin','475','300');return false;" class="formColumn">VA</a>
                                      or <a href="resourceguide/gloss_form2.asp#FHA" onclick="NewWindow(this.href,'editwin','475','300');return false;" class="formColumn">FHA</a>?</td>
                                    <td> </td>
                                    <td><table border="0" cellpadding="0" cellspacing="0" class="darkBlue10pt">
                                        <tr>
                                          <td width="55"><input type="radio" value="VA" name="CurrentFHA" >
                                            VA</td>
                                          <td width="55"><input type="radio" value="FHA" name="CurrentFHA" >
                                            FHA</td>
                                          <td><input type="radio" value="No" name="CurrentFHA" CHECKED>
                                            Neither</td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Does
                                      your mortgage payment include property taxes
                                      <br>
                                      and mortgage insurance?</td>
                                    <td> </td>
                                    <td><table border="0" cellpadding="0" cellspacing="0" class="darkBlue10pt">
                                        <tr>
                                          <td width="55"><input type="radio" value="1" name="CurrentMortInclTax" CHECKED>
                                            Yes</td>
                                          <td><input type="radio" value="0" name="CurrentMortInclTax">
                                            No</td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Do you
                                      have a second mortgage?</td>
                                    <td> </td>
                                    <td><table border="0" cellpadding="0" cellspacing="0" class="darkBlue10pt">
                                        <tr>
                                          <td width="55"><input type="radio" value="1" name="SecondMortgage" CHECKED>
                                            Yes</td>
                                          <td><input type="radio" value="0" name="SecondMortgage">
                                            No</td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">If you
                                      have a 2nd mortgage, what is the current
                                      balance?</td>
                                    <td> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" size="8" maxlength="8" name="SecondMortgageBalance" value="">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">If you
                                      have a 2nd mortgage, how much is the monthly
                                      payment?</td>
                                    <td> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" size="8" maxlength="8" name="SecondMortgagePayment" value="">
                                    </td>
                                  </tr>
                                  <tr align="center">
                                    <td colspan="3" bgcolor="#000066" class="darkBlue8pt"><font color="#FFFFFF">The
                                      following questions must be answered by
                                      all applicants.</font></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">What
                                      is your household's <span class="formColumn"><br>
                                      GROSS</span> Annual income?<br> <span class="darkBlue8ptLite">(Include
                                      commissions, bonuses<br>
                                      & child support.)</span> </td>
                                    <td width="1"> </td>
                                    <td valign="top"><span class="darkBlue8pt">$</span>  
                                      <input type="text" size="8" maxlength="8" name="GrossIncome" value="">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Please
                                      list all <span class="formColumn">TOTAL</span>
                                      credit card debt.</td>
                                    <td width="1"> </td>
                                    <td><span class="darkBlue8pt">$</span>  
                                      <input type="text" size="8" maxlength="8" name="DebtCreditCard" value=""></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Please
                                      list all <a href="">MINIMUM</a> monthly
                                      debt payments.<br> <span class="darkBlue8ptLite">What
                                      Do I Include?</span></td>
                                    <td width="1"> </td>
                                    <td valign="top"><span class="darkBlue8pt">$</span>  
                                      <input type="text" size="8" maxlength="8" name="DebtMonthTotal" value="">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Can
                                      you verify your income with paystubs and/or
                                      tax returns?</td>
                                    <td> </td>
                                    <td valign="top"><table border="0" cellpadding="0" cellspacing="0" class="darkBlue10pt">
                                        <tr>
                                          <td width="55"><input type="radio" value="1" name="VerifyIncome" CHECKED>
                                            Yes</td>
                                          <td><input type="radio" value="0" name="VerifyIncome">
                                            No</td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="right" class="darkBlue8pt"><img src="images/blue_rule.gif" width="100%" height="1"></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Please
                                      estimate your credit history:</td>
                                    <td width="1"> </td>
                                    <td><select name="CreditHistory" size="1">
                                        <option value="1" selected>Excellent</option>
                                        <option value="2">Some Problems</option>
                                        <option value="3">Major Problems</option>
                                      </select></td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="right" class="darkBlue8pt"><table width="92%" border="0" align="right" cellpadding="0" cellspacing="0">
                                        <tr valign="top">
                                          <td width="54" align="right" class="darkBlue8pt"><font size="1"><b>Excellent</b></font></td>
                                          <td width="10" rowspan="6"> </td>
                                          <td class="darkGrey8pt" width="382">Good
                                            credit history, no late payments,
                                            and an established line of credit.</td>
                                        </tr>
                                        <tr>
                                          <td align="right" class="darkBlue8pt"><font size="1"> </font></td>
                                        </tr>
                                        <tr valign="top">
                                          <td class="darkBlue8pt" align="right"><font size="1"><b>Some
                                            Problems</b></font></td>
                                          <td class="darkGrey8pt" width="382">Average
                                            line of credit, no bankruptcy, liens
                                            or foreclosures within the last 2
                                            years, and any of the following: a
                                            few late payments (30 days or less)
                                            including no more than 1 or 2 mortgage
                                            payments; 1 or 2 late payments on
                                            credit accounts (30 - 60 days late).</td>
                                        </tr>
                                        <tr>
                                          <td align="right" class="darkBlue8pt"><font size="1"> </font></td>
                                        </tr>
                                        <tr valign="top">
                                          <td class="darkBlue8pt" align="right"><font size="1"><b>Major
                                            Problems</b></font></td>
                                          <td class="darkGrey8pt" width="382">Any
                                            of the following: Little or no existing
                                            credit; collection issues; mortgage
                                            payments late 60 days or more; consumer
                                            credit accounts with payments over
                                            90 days late; bankruptcy, liens, or
                                            foreclosures within last 2 years.</td>
                                        </tr>
                                        <tr>
                                          <td>  </td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="right" class="darkBlue8pt"><img src="images/blue_rule.gif" width="100%" height="1"></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Have
                                      you had a foreclosure or filed bankruptcy
                                      in the last 7 yrs?</td>
                                    <td> </td>
                                    <td><select name="Bankruptcy" size="1">
                                        <option value="NO" selected >No</option>
                                        <option value="1 YEAR" >1 Year Ago</option>
                                        <option value="2 YEARS" >2 Years Ago</option>
                                        <option value="3 YEARS" >3 Years Ago</option>
                                        <option value="4 YEARS" >4 Years Ago</option>
                                        <option value="5 YEARS" >5 Years Ago</option>
                                        <option value="6 YEARS" >6 Years Ago</option>
                                        <option value="7 YEARS" >7 Years Ago</option>
                                      </select></td>
                                  </tr>
                                  <tr>
                                    <td align="right" class="darkBlue8pt">Have
                                      you had any tax liens or judgements against
                                      you or your property in the last 7 yrs?</td>
                                    <td> </td>
                                    <td><select name="Liens" size="1">
                                        <option value="No" selected >No</option>
                                        <option value="1 year" >1 Year Ago</option>
                                        <option value="2 years" >2 Years Ago</option>
                                        <option value="3 years" >3 Years Ago</option>
                                       
LV (Programmer)
3 Jan 04 17:37
If you take this particular code as a sample(though like theboyhope stated, it could be much cleaner), you can set a  boolean variable and just return it, depending on validation results:

<script language="JavaScript">
function validateForm(thisform){
  var isValid = true;
  if(thisform.SecondMortgage[0].checked){
    if(thisform.SecondMortgageBalance.value==''){
        alert('You must enter your current second mortgage balance.');
        isValid = false;
     }
   }

   if(thisform.SecondMortgage[0].checked){        
     if(thisform.SecondMortgagePayment.value==''){
        alert('You must enter your current second mortgage payment.');
        isValid = false;
      }
    }

  return isValid;
}
</script>
rockyroad (Programmer)
3 Jan 04 19:59
THANKS EVERYONE! I have used this latest snippet with the remainder of my script and everything works great.

Thanks Much,

RR

Start A New Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Promoting, selling, recruiting and student posting
are not allowed in the forums.
Posting Policies

LINK TO THIS FORUM!
(Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum)
TITLE: Javascript Forum at Tek-Tips
URL: http://www.tek-tips.com/threadminder.cfm?pid=216
DESCRIPTION: Javascript technical support forum and mutual help system for computer professionals. Selling and recruiting forbidden.

 

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close