Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11

Thread: Last step

  1. #1
    Regular Coder
    Join Date
    Nov 2003
    Location
    Seattle
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Last step

    I (with the help of members on this site) have developed a quiz via javascriptkt. It worked for w while and now the only thing missing is the submission of the results to me. The results show up on the form page, I put in the correct data to submit, but when I hit the submit button, it does not submit and gives me an error msg.

    My question is: Does the error msg. (line 168) directly correspond with the line in the script? And do you count every line, even those that have nothing on them. Below is the script. Any help would be appreciated as this is the last link to sending out a newsletter with a link to the quiz.

    The link is http://www.dreamsonthefly.com/januaryquiz.html


    <html>
    <head>
    <title>December Quiz</title>
    <script type="text/javascript" src="quizconfig.js"></script>
    <!--//
    function setCookie() {
    duit = new Date();
    duit.setTime(duit.getTime() + 30*24*60*60*1000);
    var expString = "; expires=" + duit.toGMTString();
    document.cookie = document.title + expString;
    }

    function submitData() {
    var dc = document.cookie;
    if(dc.match(document.title)) {
    notice = "Thank You for your interest in taking our "+document.title+".\n";
    notice+= "BUT, YOU MAY ONLY SUBMIT THE TEST ONE TIME!\n";
    notice+= "You will now be redirected to Our Home Page.\n";
    alert(notice);
    window.location.replace('/');
    }
    else {
    var correct = document.result.CORRECT.value;
    var sub = correct+ ' correct answers on your December Test!';
    var name = document.thedata.NAME.value;
    if (!name) {
    alert('You must enter your name');
    document.thedata.NAME.focus();
    return false;
    }
    else {
    document.senddata.NAME.value = name;
    }
    var contact = document.thedata.CONTACT.value;
    if (!contact) {
    alert('You must enter your e-mail address');
    document.thedata.CONTACT.focus();
    return false;
    }
    else {
    document.senddata.CONTACT.value = contact;
    }
    var from = document.thedata.FROM.value;
    if (!from) {
    from = 'No Data Submitted';
    document.senddata.FROM.value = from;
    }
    else {
    document.senddata.FROM.value = from;
    }
    var comment = document.thedata.COMMENT.value;
    if (!comment) {
    comment = 'No Comments Made.';
    document.senddata.COMMENT.value = comment;
    }
    else {
    document.senddata.COMMENT.value = comment;
    }
    document.senddata.PERCENTAGE.value = document.result.q.value;
    document.senddata.CORRECT_ANSWERS.value = document.result.p.value;
    document.senddata.WRONG_ANSWERS.value = document.result.T2.value;
    document.senddata.action="http://pub7.bravenet.com/emailfwd/senddata.php"
    document.senddata.submit();
    }
    }
    // -->
    </script>
    </head>

    <body bgcolor="#FFFFFF" onunload="setCookie()">
    <p align="center"><strong><font face="Arial">
    <big>Instant Quiz Results</big></font></strong></p>

    <div align="center">
    <center>
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="100%">
    <form name="result">
    <input type="hidden" name="CORRECT" value="">
    <table border="0" width="100%" cellpadding="0" height="116">
    <tr>
    <td height="25" bgcolor="#DBE0F5"><strong><font face="Arial"># of questions you got right:</font></strong></td>
    <td height="25"><p><input type="text" name="p" size="24"></td>
    </tr>
    <tr>
    <td height="17" bgcolor="#DBE0F5"><strong><font face="Arial">The questions you got wrong:</font></strong></td>
    <td height="17"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>
    </tr>
    <tr>
    <td height="25" bgcolor="#DBE0F5"><strong><font face="Arial">Grade in percentage:</font></strong></td>
    <td height="25"><input type="text" name="q" size="8"></td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    </table>
    </center>
    </div>

    <div align="center">
    <center>
    <p>
    <script type="text/javascript">
    var wrong=0
    for (e=0;e<=2;e++)
    document.result[e].value=""

    var results=document.cookie.split(";")
    for (n=0;n<=results.length-1;n++){
    if (results[n].charAt(1)=='q')
    parse=n
    }

    var incorrect=results[parse].split("=")
    incorrect=incorrect[1].split("/")
    if (incorrect[incorrect.length-1]=='b')
    incorrect=""
    document.result[1].value=totalquestions-incorrect.length+" out of "+totalquestions
    document.result[3].value=(totalquestions-incorrect.length)/totalquestions*100+"%"
    for (temp=0;temp<incorrect.length;temp++)
    document.result[2].value+=incorrect[temp]+", "
    correct = totalquestions-incorrect.length;
    document.result.CORRECT.value = correct;
    </script>
    <form name="thnx">
    <input type="button" value="Submit your answers by entering your information below" name="B1" onClick="location.replace('/');">
    </form>


    <!-- Start Bravenet.com Service Code -->
    <div align=center>

    <div style="border:1px solid #999999; width:255px; margin-bottom:5px;background-color:#F2F4FA;">
    <form name="senddata" method="post" enctype="multipart/form-data" style="margin:0px;">
    <input type="hidden" name="NAME" value="" />
    <input type="hidden" name="CONTACT" value="" />
    <input type="hidden" name="FROM" value="" />
    <input type="hidden" name="COMMENT" value="" />
    <input type="hidden" name="PERCENTAGE" value="" />
    <input type="hidden" name="CORRECT_ANSWERS" value="" />
    <input type="hidden" name="WRONG_ANSWERS" value="" />
    <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
    <input type="hidden" name="usernum" value="587815930" />
    <input type="hidden" name="cpv" value="2" />
    </form>

    <div style="background-color:#DBE0F5; padding:3px; font:12px arial; color:black;">
    <b>Your Answers will submit automatically when you complete this form</b>
    </div>

    <form name="thedata">
    <div style="padding:10px; font: normal 12px Arial; text-align:left;">
    What is your name?<br />
    <input type="text" name="NAME" size="34" style="width:230px;" /><br />
    E-mail address?<br />
    <input type="text" name="CONTACT" size="34" style="width:230px;" /><br />
    Where are you from?<br />
    <input type="text" name="FROM" size="34" style="width:230px;" /><br />
    Any Comments?<br />
    <input type="text" name="COMMENT" size="34" style="width:230px;" /><br />
    </form>
    </div>

    <div align="center">
    <form name="datasubmit">
    <input type="button" name="send" value=" Submit" onClick="submitData();">
    <input type="button" name="reset" value=" Clear " onClick="document.thedata.reset();">
    </form>
    </div>

    <div align="center" style="margin:10px;">
    <a style="font: bold 10px tahoma,arial; text-decoration: none;"
    href="http://www.bravenet.com" target="_new">
    powered by <img src="http://images.bravenet.com/bravenet/images/poweredby.gif"
    border="0" align="absmiddle" alt="Powered by Bravenet" /> bravenet.com</a>
    </div>

    </div>
    </div>
    <!-- End Bravenet.com Service Code --></div>

    <p id="footnote" align="center"><font face="arial" size="-1">Quiz script provided by<br>
    <a href="http://www.javascriptkit.com">JavaScriptKit.com</a></font></p>
    </body>
    </html>

    Thank you.


    __________________
    Dreams on the Fly
    http://www.dreamsonthefly.com
    Dreams on the Fly
    http://www.dreamsonthefly.com

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry I forgot about you.
    I'll go check my mail now.
    .....Willy

  • #3
    Regular Coder
    Join Date
    Nov 2003
    Location
    Seattle
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forgotten

    Ah Willy:

    A girl goes and gets married and is now forgotten!
    Dreams on the Fly
    http://www.dreamsonthefly.com

  • #4
    Regular Coder
    Join Date
    Nov 2003
    Location
    Seattle
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Oh Willy!!!

    How'd you do that? It's working. I have looked at that script trying to diagnose the problem, and viola you found it. Where the heck was it?

    Rhonda
    Dreams on the Fly
    http://www.dreamsonthefly.com

  • #5
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forgotten

    Originally posted by dreamsonthefly
    Ah Willy:

    A girl goes and gets married and is now forgotten!
    Well there are more fish in the sea you know!
    Congrats on your nuptials!

    I just looked at your page and found the opening script tags missing.
    Code:
    html>
    <head>
    <title>January Quiz</title>
    <script  type="text/javascript" src="quizconfig.js"></script>
    <script  type="text/javascript" >
    <!--//
    function setCookie() {
    duit = new Date();
    duit.setTime(duit.getTime() + 30*24*60*60*1000);
    var expString = "; expires=" + duit.toGMTString();
    document.cookie = document.title + expString;
    }
    
    function submitData() {
    I just made the changes on my copies and submitted the test.
    Let me know if you recieve the results. If so, I'll send you the
    revised codes as an attachment.

    .....Willy

  • #6
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Oh Willy!!!

    Originally posted by dreamsonthefly
    How'd you do that? It's working. I have looked at that script trying to diagnose the problem, and viola you found it. Where the heck was it?

    Rhonda
    I guess this means you got the results.
    Can you add:
    <script type="text/javascript">

    Or would you like me to send an attachement?

    Also; On my copy, I have changed this line:
    Code:
    else {
    var correct = document.result.CORRECT.value;
    var sub =  correct+ ' correct answers on your '+document.title+'!';
    So that only the title of the page needs to change month to
    month and there should be no further script changes.

    .....Willy

  • #7
    Regular Coder
    Join Date
    Nov 2003
    Location
    Seattle
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Okay I can ...

    I can put in the <script type="text/javascript">

    where else {
    var correct = document.result.CORRECT.value;
    var sub = correct+ ' correct answers on your '+document.title+'!';

    you want me to put it in like this

    else {
    var correct = document.result.CORRECT.value;
    var sub = correct+ ' correct answers on your '+januaryquiz.html+'!';
    Dreams on the Fly
    http://www.dreamsonthefly.com

  • #8
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No;

    Change this line:
    Code:
    var sub =  correct+ ' correct answers on your December Test!';
    With this:
    Code:
    var sub =  correct+ ' correct answers on your '+document.title+'!';
    This way you would only need to change your document title from
    month to month and not have to make any further changes to
    the resuls.htm page codes

    EG:
    Code:
    <html>
    <head>
    <title>December Quiz</title>
    <script type="text/javascript" src="quizconfig.js"></script>
    .....Willy

  • #9
    Regular Coder
    Join Date
    Nov 2003
    Location
    Seattle
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Okay

    Willy, I think it best that I delete all of the past ones. So I am going to delete them and if you can send me the revised one, the one we just tested, I should only have one of these in my files. It's so difficult not being able to rename them.

    Thank you ever so much.

    BTW...we have one spot available for steelhead fishing on the Hoh 3/7-3/10 or 3/25-3/27. You just fly, we'll do the rest.

    Rhonda
    Dreams on the Fly
    http://www.dreamsonthefly.com

  • #10
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sounds tempting, It would be dependent on the weather if I
    could take off of work. Not that I'm afraid to fish in the rain,
    but I am in the construction business.

    Yes; Please delete all copies you have so there will be
    no worries of mixups. I'll go send the attachements now.

    .....Willy
    Last edited by Willy Duitt; 01-09-2004 at 07:01 AM.

  • #11
    Regular Coder
    Join Date
    Nov 2003
    Location
    Seattle
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Yahoo

    Yep I got your submission all works.

    Thanks Willy, if you change your mind about the fishing you know where to find us.

    Rhonda
    Dreams on the Fly
    http://www.dreamsonthefly.com


  •  

    Posting Permissions

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