modal dialogs and submit form 
Author Message
 modal dialogs and submit form

Hey All,

I have had this problem with modal dialogs and submitting form, the thing is
YOU CANNOT DO THAT. and i understand, so what i did was I made a javascript
object:

function FormData(frm) {

Quote:
}

FormData.prototype = {
  action:     "",
  method:    "",
  data:    new Array(),

  exec:    function () { SaveFields(this.data); },
  toString:    function () { return "Modal.FormData"; }

Quote:
}

function ReturnAndClose(o) {
  if (typeof window.dialogArguments != "undefined") {
    window.returnValue = o;
    window.close();
  }
  return false;

Quote:
}

And I have my html like this:

<form action="bla.asp" method="post" onsubmit="ReturnAndClose(new
FormData(this))">
...
</form>

And the opener page calls it like this:

var obj = window.showModalDialog("bla.asp", "bla bla bla");
if (obj) obj.exec();

This seems like its a good trick and it will work, but the problem is IT
DOESNT WORK.  It gives me an error message: "Cant Execute Code From Freed
Script"

Does anybody know what i can do to make this work under internet explorer
5.0+

Regards,
MoMad



Tue, 29 Nov 2005 04:33:51 GMT  
 modal dialogs and submit form
I don't quite understand the problem but to post form data from a modal
dialogue you can have an iframe in the main page holding the form and all
its content and post the form to that.
I suspect the error message is happening because the objects used no longer
exist.
--

Joe


Quote:
> Hey All,

> I have had this problem with modal dialogs and submitting form, the thing
is
> YOU CANNOT DO THAT. and i understand, so what i did was I made a
javascript
> object:

> function FormData(frm) {
> }
> FormData.prototype = {
>   action:     "",
>   method:    "",
>   data:    new Array(),

>   exec:    function () { SaveFields(this.data); },
>   toString:    function () { return "Modal.FormData"; }
> }
> function ReturnAndClose(o) {
>   if (typeof window.dialogArguments != "undefined") {
>     window.returnValue = o;
>     window.close();
>   }
>   return false;
> }

> And I have my html like this:

> <form action="bla.asp" method="post" onsubmit="ReturnAndClose(new
> FormData(this))">
> ...
> </form>

> And the opener page calls it like this:

> var obj = window.showModalDialog("bla.asp", "bla bla bla");
> if (obj) obj.exec();

> This seems like its a good trick and it will work, but the problem is IT
> DOESNT WORK.  It gives me an error message: "Cant Execute Code From Freed
> Script"

> Does anybody know what i can do to make this work under internet explorer
> 5.0+

> Regards,
> MoMad



Tue, 29 Nov 2005 15:28:35 GMT  
 modal dialogs and submit form
Thanks Joe,

I figured it out. Modal dialogs suck.

Regards,
MoMad


Quote:
> I don't quite understand the problem but to post form data from a modal
> dialogue you can have an iframe in the main page holding the form and all
> its content and post the form to that.
> I suspect the error message is happening because the objects used no
longer
> exist.
> --

> Joe



Wed, 30 Nov 2005 01:32:52 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. submitting forms within modal dialogs?

2. Posting a form from a modal dialog to a IFRAME in the Dialog

3. Problem when submit in a Modal Dialog.

4. Getting FORM values from modal dialog

5. Modal Dialog and Form

6. submitting a form within a modal window

7. Modal Dialogs and Arrays as Dialog Arguments

8. Closing a Modal Dialog

9. Modal dialog

10. Modal dialog windows

11. Problem with Modal Dialogs

12. "Opener" of a modal dialog box

 

 
Powered by phpBB® Forum Software