Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Fire Event

Posted on 1998-07-04
3
Medium Priority
?
400 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

618 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