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: Javascript help

  1. #1
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript help

    I need you help. I am trying to create an online quiz. I have 2 files, the Quiz.htm and Quiz.js. The questions are in the Quiz.htm and when you click on the evaluate button, it generates a Result page (all text) through quiz.js. The problem is, there are only 2 buttons available on that new page, the PRINT and the CLOSE. I would like to add another button to submit the results to a certain email address. I already have cgi and formmail capability. the problem is that how will I add a button to send all the result information to a particular email address?

    Here is the script for the 2 buttons:

    winr.document.write("<input type='button' value='Print...' onClick='"+printest+"'>&nbsp;&nbsp;&nbsp;&nbsp;")
    winr.document.write("<input type='button' value='Close' onClick='window.close()'></form></center>")

    I would like to add another button to submit all results pointing to my cgi url. please help.

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    onclick="document.formname.subit();" and have the submit code for the cgi in the form tag

  • #3
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you. How do i exactly code it? here is the url for my cgi:

    "http://dbscreations.netfirms.com/cgi/formmail".

    I am not sure how to code it properly, maybe you can help me with this.

    Thanks

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    -27° 28' 22" , 153° 1' 22"
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Something like the following I suppose.

    Code:
    winr.document.write("<form name='formname' method='post' action='http://dbscreations.netfirms.com/cgi/formmail'>")
    
    winr.document.write("<input type='button' value='Print...' onClick='"+printest+"'> ")
    winr.document.write("<input type='button' value='Submit' onClick='document.formname.submit();'>")
    winr.document.write("<input type='button' value='Close' onClick='window.close()'></form></center>")
    "Computers are considered female - As soon as you make a commitment to one, you find yourself spending half your paycheck on accessories for it."

  • #5
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much! We are getting close. How will I code it so it will send an email to dbs576@aol.com with a subject: Assessment Test.

    In HTML I can just declare the recipient and the subject but I don't know how to do it in javascript. Kindly include the recipient and the subject in the coding.

    I am very sorry to bother you, I hope you can lead me through making this work.

    If it's okay with you, I can settle for a Instant Message conversations.

    I really appreciate what you are doing.

    Thanks!

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    -27° 28' 22" , 153° 1' 22"
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It depends on your cgi-script and what it requires to send an email. I would try the following and see if you get an email.

    Code:
    winr.document.write("<center><form name='formname' method='post' action='http://dbscreations.netfirms.com/cgi/formmail'>")
    winr.document.write("<input type='button' value='Print...' onClick='"+printest+"'> ")
    winr.document.write("<input type='button' value='Submit' onClick='document.formname.submit();'>")
    winr.document.write("<input type='button' value='Close' onClick='window.close()'>")
    winr.document.write("<input type='hidden' name='subject' value='Email Subject Here'>")
    winr.document.write("<input type='hidden' name='recipient' value='dbs576@aol.com'>")
    winr.document.write("<input type='hidden' name='redirect' value='http://www.yoursite.com'></form></center>")
    "Computers are considered female - As soon as you make a commitment to one, you find yourself spending half your paycheck on accessories for it."

  • #7
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry it did not send me an email. It is maybe that I need a separate cgi file to process and send the data. What I am using right now is I am suing netfirms formmail handler which I think is the cause of the problem.

    Do you know a cgi I can use to make this happen? Or if you can make me one. I know it's too much to ask, but I really am greatful for your suppport.

    More power to you.

    Dennis

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    -27° 28' 22" , 153° 1' 22"
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Dennis,

    Have a look at these two files I found on google. One is the html file with the hidden field syou need to use and the other is a perl script file used to perform the email sending. Note that to use the perl file this will need to be on a box that reconises .pl files. If you can use the perl file, read the notes and add the neccessary elements so that you can receive email.

    Anyhow, have a look and see what you can sort out.

    Cheers....Matthew
    Attached Files Attached Files
    "Computers are considered female - As soon as you make a commitment to one, you find yourself spending half your paycheck on accessories for it."

  • #9
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks! I'll keep you posted.

  • #10
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, it did not work. Would you like me to send you the files so you can check them out?

    Thanks!

  • #11
    Regular Coder
    Join Date
    Jun 2002
    Location
    -27° 28' 22" , 153° 1' 22"
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah
    "Computers are considered female - As soon as you make a commitment to one, you find yourself spending half your paycheck on accessories for it."


  •  

    Posting Permissions

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