Solved

Fire Event

Posted on 1998-07-04
3
385 Views
Last Modified: 2008-03-17
I need to fire and event in a JavaScript.  Specifically, I created a form like so:

</script>
<script language = "JavaScript">
document.write('<FORM NAME="BetaTest" METHOD=POST ACTION="http://www.interlink-2000.com/cgi-bin/formmail.cgi">')
document.write('<INPUT TYPE="HIDDEN" NAME="subject" VALUE="Survey Response">')
document.write('<INPUT TYPE="HIDDEN" NAME="recipient" VALUE="dirtdart@apex.net">')
document.write('<INPUT TYPE="HIDDEN" NAME="return-email" VALUE=email>')
document.write('<INPUT TYPE="HIDDEN" NAME="return-name" VALUE=ename>')
document.write('<INPUT TYPE="HIDDEN" NAME="City" VALUE=city>')
document.write('<INPUT TYPE="HIDDEN" NAME="State" VALUE=state>')
document.write('<INPUT TYPE="HIDDEN" NAME="Country" VALUE=country>')
document.write('<INPUT TYPE="HIDDEN" NAME="OS" VALUE=os>')
document.write('<INPUT TYPE="HIDDEN" NAME="VBVersion" VALUE=VBVersion>')
document.write('<INPUT TYPE="SUBMIT" NAME="Submit">')
</script>

From another section of the script, I need to fire the Submit button's click event.  Anyone know how to do it?
0
Comment
Question by:dirtdart
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
jbrugman earned 50 total points
ID: 1266246
Since your question is not totally clear to me, i would suggest you to have a look at www.dannyg.com (go to the mini faq)
    Do you want a button to submit this form, or do you want a JavaScript command to submit this form?
    you can send a form, from anywhere in the script with the command:
    document.BetaTest.submit();
    Good luck
0
 
LVL 5

Author Comment

by:dirtdart
ID: 1266247
Maybe it's just me, but it's just not working.  What you've said is what I'm looking for, but I can't seem to get it to work.  Here's what I'm doing.

I have an input form on another page in another frame.  The final destination of this information is a cgi script on another server.  But before it gets there, I would like to validate that all the information is there.  To do that, I sent the information to another frame to make sure it is all there.  When it is verified that the information is present, then the script should insert the information into hidden form fields, submit it to the cgi script and load another page into the first frame.  The page is loading into the first frame, but the form is not submitting.  Here's the code:

function ValidInfo(subject, recipient, ename, email, city, state, country, os, vbversion)
{
      MissingInfo = new String("");
      
      if(ename == "")
            MissingInfo = MissingInfo + "Your+Name";
      if(email == "")
      {
            if(MissingInfo.length > 0)
                  MissingInfo = MissingInfo + ",";
            MissingInfo = MissingInfo + "Your+Email";
      }
      if(os == "")
      {
            if(MissingInfo.length > 0)
                  MissingInfo = MissingInfo + ",";
            MissingInfo = MissingInfo + "Your+Operating+System+Version";
      }
      if(vbversion == "")
      {
            if(MissingInfo.length > 0)
                  MissingInfo = MissingInfo + ",";
            MissingInfo = MissingInfo + "Your+Visual+Basic+Version";
      }
      if(MissingInfo.length > 0)
      {
            parent.frames[1].location = "miss.html?" + MissingInfo;
      }
      else
      {
            parent.frames[1].location = "http://www.apex.net/users/dirtdart/ApiHelper.htm";
            BetaTest.return_email.value = email;
            BetaTest.return_name.value = ename;
            BetaTest.City.value = city;
            BetaTest.State.value = state;
            BetaTest.Country.value = Country;
            BetaTest.OS.value = os;
            BetaTest.VBVersion.value = vbversion;
            BetaTest.SUBMIT();
      }
}

It doesn't even have to be done in this way if you can suggest some better way to do it.  I just want to verify that all the information is there before it goes to the cgi.
0
 
LVL 5

Author Comment

by:dirtdart
ID: 1266248
Well, I got the form working.  Turns out I didn't need the submit method, but you gave me the right answer anyway, so I'll give you the points.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now