Forms, and Submit issues...

Results 1 to 3 of 3

Thread: Forms, and Submit issues...

  1. #1
    Join Date
    Dec 1969

    Default Forms, and Submit issues...

    Hello all! <BR> ok, here&#039s a weird one.. =) I&#039ve got two pages. the first page (First.asp) has 3 submit buttons, I pass the value of the submits into 2nd.asp. this works great!!!! the question is.. after, all of that has been set and done, I need to return a form from 2nd.asp BACK to first.asp.. but I do not want to use another submit button, for this to work.. is there any other way to pull this off???

  2. #2
    David Mann Guest

    Default Yes, there is.

    Forms have two types of buttons:<BR><BR>type="submit" and type="button".<BR><BR>Both can be used to do a submission, but the real method that submits a form is the form.submit() method. This magic piece of code is what causes a form submission, and it can be triggered by nearly any event handler. <BR><BR>So what does this mean to us? Well, let&#039s say you want an html page to fire off a form 3 seconds after it loads. What do you do? You use the onLoad event associated with the &#060;body&#062; tag.<BR><BR>Code:<BR><BR>&#060;body onLoad="transferData(3)"&#062;<BR><BR>K, now at the end of the page before the final &#060;/body&#062;, create your script:<BR><BR>&#060;script language="JavaScript"&#062;<BR>function transferData(stallTime)<BR>{<BR>document.formName. submit()<BR>//location.href = "yourfirstasp.asp"<BR>setTimeout("transferData(sta llTime)", 3000)<BR>}<BR>&#060;/script&#062;<BR><BR>There you go! The script now redirects or resubmits (comment the one you want to not function and uncomment the one you do want to function) to where ever you wish. With a little additional input on the ASP level, you can make this script do what ever you want. <BR><BR>Note on the time value 3000: This is 3000 milliseconds or 3 seconds. setTimeout() takes values in milliseconds instead of seconds. =)<BR><BR>This should work. Let me know if this helps!<BR><BR>Sincerely,<BR> --David

  3. #3
    Join Date
    Dec 1969

    Default RE: Yes, there is.

    As always... you are the man!! and thank you for your help!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts