Is this possible?

Results 1 to 4 of 4

Thread: Is this possible?

  1. #1
    Join Date
    Dec 1969
    Posts
    115

    Default Is this possible?

    What I have is a form submitting to itself after user selection,<BR>on the final submit (to another page) I want to run validation<BR>I have the validation script working but not sure how to call it..<BR>the final submit works on a javascript function, like so<BR>function gonext()<BR> {<BR>document.part1.action = "part1save.asp"<BR>document.part1.method = "post"<BR>line in question---&#062;document.part1.onsubmit="return checkform(forms(&#039;part1&#039;), &#039;#ff9999&#039;, &#039;#ffffff&#039;, true, false, &#039;&#039;);"&#062;<BR>document.part1.submit();< BR> }<BR><BR>Thanks for any suggestions

  2. #2
    Join Date
    Dec 1969
    Posts
    19,082

    Default RE: Is this possible?

    http://rtfm.atrax.co.uk/infinitemonkeys/articles/javascript/976.asp

  3. #3
    Join Date
    Dec 1969
    Posts
    96,118

    Default And the short answer is 'no'...

    ...because when you assign a function to a handler, you have to assign the *address* of the function, and that implies you can&#039;t pass any arguments to the function at the time of the assignment.<BR><BR>In other words, you could do<BR> document.part1.submit = checkform; // notice no parens!<BR><BR>But that will do nothing helpful for you.<BR><BR>But I don&#039;t understand why your are working so hard.<BR><BR>function gonext()<BR>{<BR> var theForm = document.part1;<BR> if ( checkform(theForm, &#039;#ff9999&#039;, &#039;#ffffff&#039;, true, false, &#039;&#039;)<BR> {<BR> theForm.action = "part1save.asp"<BR> theForm.method = "post"<BR> theForm.submit();<BR> } else {<BR> alert("Sorry, that form didn&#039;t validate!");<BR> }<BR>}<BR><BR>Atrax&#039;s answer is fine as far as it goes, but I do understand why you want to do this only after all the submits-to-self are done. And then the easiest way is to simply not *DO* the submit() if the validation fails.<BR><BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    115

    Default Thanks..

    Again...


Posting Permissions

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