Link to home
Start Free TrialLog in
Avatar of dirtdart
dirtdart

asked on

Fire Event

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?
ASKER CERTIFIED SOLUTION
Avatar of jbrugman
jbrugman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dirtdart
dirtdart

ASKER

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.
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.