?
Solved

Fire Event

Posted on 1998-07-04
3
Medium Priority
?
394 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
jbrugman earned 150 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…
Suggested Courses

752 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