Solved

Fire Event

Posted on 1998-07-04
3
390 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 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Only allow one check box 17 39
Session on Html 8 38
Html using "Or" in condition 3 25
Prevent certain words from being typed in a form 6 27
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

763 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