ShowModalDialog postback - SOLUTION

J

Jinx

Windows IE
..NET

PROBLEM:
After invoking showModalDialog(), a form comes up, the user clicks
submit, and a NEW webpage opens.

SOLUTION
After reading numerous posts that say, paraphrased, "This can't be
done, you have to use IFRAMES", I thought I just post a solution.
Lets be careful with the "cannot be done" posts.

All you need to do is put this code in the <HEAD> of your modal page:
<SCRIPT LANGUAGE="JScript">
window.name="modal";
</SCRIPT>

and target="modal" in your modal <FORM> tag. No need for IFRAMES.

Also, when calling the showModalDialog, pass in a random number as a
querystring parameter. This will ensure that the modal won't cache
like they love to do.

var myRand = rand(50000);
var modal = window.showModalDialog('mypage.aspx?rand='+myRand, 0,
windowoptions);

RANDOM FUNCTIONS
function rnd() {
today=new Date();
jran=today.getTime();

ia=9301;
ic=49297;
im=233280;
jran = (jran*ia+ic) % im;
return jran/(im*1.0);
}

function rand(number) {
return Math.ceil(rnd()*number);
}

Hope that helps,

Jinx
http://www.JinxGear.com
 
Joined
Jan 21, 2008
Messages
1
Reaction score
0
I've always found putting <base target=_self> in the head of the page to work but maybe I'm not understanding the complete problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top