Results 1 to 5 of 5

Thread: Please Help...

  1. #1

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433

    Exclamation Please Help...

    Hey All,

    This is what I need to do:
    (It has to do with form validation)

    I first want to check that a variable is equal to the string: "CONFIRM CHECKED", if it is, continue the function, if not, display an alert message. Then I want it to check that two fields are not equal to each other: if dis_frm.egold.value == dis_frm.referrer.value...

    This is what I have, but it's seriously wrong.

    function checkIt(el){
    var chkd=""
    for(var i=0; i<el.length; i++)
    if (el[i].type=="checkbox" && el[i].checked) chkd+=el[i].name;

    if (chkd!="CONFIRM CHECKED"){
    alert("Please check all boxes");
    return;
    }
    if (dis_frm.egold.value == dis_frm.referrer.value){
    alert("You cannot refer yourself");
    return;
    }
    else
    document.forms["dis_frm"].submit();
    dis_frm.sub.value = "Loading...";
    }
    }

  2. #2
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Hi, can you post the code for the form so I can have a look at it, its just a bit easier when you have the form code too

    Cheers
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  3. #3

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433
    <html>

    <head>
    <title>Offshore Professional</title>

    <style>
    td.std {
    font-family: Verdana, Arial;
    font-size: 8pt;
    }
    a.bld {
    font-family: Verdana, Arial;
    font-size: 8pt;
    font-weight: bold;
    }
    a.astd {
    font-family: Verdana, Arial;
    font-size: 8pt;
    color: #2474B5;
    }
    a.astd:hover {
    font-family: Verdana, Arial;
    font-size: 8pt;
    color: #000000;
    }
    </style>
    <script type="text/javascript">
    <!--//
    function checkIt(el){
    var chkd=""
    for(var i=0; i<el.length; i++)
    if (el[i].type=="checkbox" && el[i].checked) chkd+=el[i].name;

    if (chkd!="CONFIRM CHECKED"){
    alert("Please check all boxes");
    return;
    }
    if (dis_frm.egold.value == dis_frm.referrer.value){
    alert("You cannot refer yourself");
    return;
    }
    else
    document.forms["dis_frm"].submit();
    dis_frm.sub.value = "Loading...";
    }
    }
    //-->
    </script>
    </head>
    <body alink="#2474B5" vlink="#2474B5" onload="">
    <center>
    <img src="offpro2.gif" width="762" height="62" alt="" border="0" align="">
    <br>
    <img src="osp_disclaimer.gif" width="118" height="40" alt="" border="0" align="">
    <form name="dis_frm" action="subscribe.cgi" method="post">
    <table bgcolor="#EAF1F8" width="70%" cellspacing="0" cellpadding="10" border="" style="border: 3d">
    <tr>
    <td class="std">
    <p><input type="checkbox" name="C" value=""> I understand that I am agreeing to join a PRIVATE MEMBERS
    SITE, A PRIVATE FORUM, and PRIVATE ASSOCIATED MAILING
    LISTS and understand that I must be referred by an existing
    member.
    <p><input type="checkbox" name="O" value=""> I understand that all and any information I may receive on this web site,
    private forum, and associated mailing lists is for informational purposes
    only and is intended to inform accredited, foreign, and sophisticated
    investors only.
    <p><input type="checkbox" name="N" value=""> I understand that much of the information received on this web site, forum,
    and mailing list will be of a private nature, not
    available to the general public, exempt from the U.S. Securities Act of 1933 and
    all amendments, and is NOT intended for public dissemination.
    <p><input type="checkbox" name="F" value=""> I agree to take responsibility for understanding the difference between a
    private offering and a security as governed by the U.S. Securities Act of 1933
    and all amendments.
    <p><input type="checkbox" name="I" value=""> I agree that under no circumstances should any information found on this web site, private forum, and associated mailing lists be considered
    or construed as an offer to sell securities or a solicitation to invest in any programme or private arrangement in any
    jurisdiction in which such offer or solicitation is not lawful, or to anyone to whom it is unlawful to make such an offer or
    solicitation.
    <p><input type="checkbox" name="R" value=""> I understand and agree that the Moderators of this group are in no way
    responsible for the performance or lack of performance of any
    investment or private arrangement that comes to my attention on this web site,
    private forum, and associated mailing lists.
    <p><input type="checkbox" name="M" value=""> I agree that I am completely
    responsible for all investment decisions made based on any information found
    within this web site, private forum, and associated mailing lists.
    <p><input type="checkbox" name=" " value=""> I agree that nothing on this web
    site, private forum, and associated mailing lists is presented as expert advice
    from professional investment advisors and I agree to use my own judgment and
    practice due diligence should I ever choose to invest in any club, programme, or
    private arrangement brought to my attention on this web site, private forum, and
    associated mailing lists.
    <p><input type="checkbox" name="C" value=""> I agree, acknowledge, and accept that
    all information received is unsolicited, private communications of privileged,
    proprietary, and confidential information for my eyes only and agree to keep
    it private, confidential, and protected from any disclosure unless specifically
    permitted or the information is obviously of a public nature.
    <p><input type="checkbox" name="H" value=""> I agree to hold the Moderators and
    Administrators of this web site, private forum, and associated mailing lists
    completely harmless of any liability.
    <p><input type="checkbox" name="E" value=""> I understand that private investing
    is HIGH RISK and I agree that, should I invest in any private arrangement, club,
    or programme brought to my attention on this web site, private forum, and
    associated mailing lists, I will only invest EXPENDABLE FUNDS that I can afford
    to LOSE.
    <p><input type="checkbox" name="C" value=""> If I elect to invest in any club,
    programme, or private arrangement brought to my attention on this website, forum,
    or mailing list I acknowledge that I am doing so at entirely at MY OWN RISK.
    <p><input type="checkbox" name="K" value=""> I understand and agree that in ALL
    investment PAST PERFORMANCE is no guarantee of the same future performance.
    <p><input type="checkbox" name="E" value=""> I understand that the distribution
    of material / information that comes to my attention on this list may be
    restricted by law in certain jurisdictions. Persons on this list are required to
    inform themselves about and observe any such restrictions.
    <p><input type="checkbox" name="D" value=""> I am at least 18 years of age.
    </td>
    </tr>
    </table>
    <br>
    <table border="" width="70%" bgcolor="#EAF1F8" style="border: 3d" cellpadding="10" cellspacing="0">
    <tr>
    <td>
    <table align="left" border="0" width="100%" cellspacing="0" cellpadding="2">
    <tr>
    <td class="std">Name</td>
    <td class="std"><input type="text" name="name" size="20" style="width: 160px; border-width: 1; font-size: 11; font-family: Verdana"></td>
    </tr>
    <tr>
    <tr>
    <td class="std">E-Gold Account</td>
    <td class="std"><input type="text" name="egold" size="20" style="width: 160px; border-width: 1; font-size: 11; font-family: Verdana">&nbsp; Open a free e-gold account <a class="astd" href="http://www.e-gold.com/e-gold.asp?cid=116656">here</a></td>
    </tr>
    <tr>
    <td class="std">Email</td>
    <td class="std"><input type="text" name="email" size="20" style="width: 160px; border-width: 1; font-size: 11; font-family: Verdana"></td>
    </tr>
    <tr>
    <td class="std">Referrer #</td>
    <td class="std"><input type="text" name="referrer" size="20" style="width: 160px; border-width: 1; font-size: 11; font-family: Verdana">&nbsp; If you have no referrer click <a class="astd" href="mailto:[email protected]">here</a></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <br>
    <input type="button" name="sub" onClick="checkIt(document.dis_frm.elements)" value=" Accept " style="font-family: Verdana, Arial; font-size: 8pt; background-color: #EAF1F8">
    </form>
    <center>
    <table>
    <tr>
    <td class="std">
    <br>
    Copyright &copy; 2002, Offshore Professional. All Rights Reserved. Site Design by <a href="mailto:[email protected]" class="astd">lonedesign, Inc.</a>
    </td>
    </tr>
    </table>
    </table>
    </body>
    </html>


    THANKS.

  4. #4
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Hi,

    I copied and pasted the code and run it in IE 5.5 and got an error in the Javascript (which I'm sure is what you were getting ). However, I added and changed the { } in the code it now appears to be OK.

    Code:
    function checkIt(el){ 
      var chkd="" 
      for(var i=0; i<el.length; i++) 
        if (el[i].type=="checkbox" && el[i].checked){ chkd+=el[i].name;} 
    
        if (chkd!="CONFIRM CHECKED"){ 
          alert("Please check all boxes"); 
          return; 
    		} 
    		if (dis_frm.egold.value == dis_frm.referrer.value){ 
    			alert("You cannot refer yourself");
    			return; 
    		} else { 
    		document.forms["dis_frm"].submit(); 
    		dis_frm.sub.value = "Loading..."; 
       } 
    }
    Hope this what you were trying to do.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  5. #5

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433
    Thanks punkpie_uk

    After trying to figure this out for ages, I finally do 2 minutes before you post an answer!

    cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width