S14321K
S14321K

Reputation: 230

Passing JavaScript function from parent.jsp to showModalDialog without creating .js file

Here I have a js function() in parent.jsp. From parent.jsp I'm redirecting the page to showModalDialog for validation purpose. I want the function() to be called in showModalDialog and the validated values should get returned back to parent.jsp. Without creating the .js file. Is this possible?

If you cant understand my question, please have alook at the flow

one.jsp
<script>
function1()
{
  ...
}
url=two.jsp
</script>

After redirecting to page two

showModalDialog
function2()
{
  function1()
}

I passed the values from parent.jsp to showModalDialog by assigning

Url ="../jsp/validateshowModalDialog.do="&varCurrentValue="+varCurrentValue+"&varCurrentRow="+varCurrentRow;

And also I would like to pass the function() to showModalDialog *Without creating the .js file

Upvotes: 0

Views: 201

Answers (2)

S14321K
S14321K

Reputation: 230

Function from parent.jsp

Parent.jsp

function parnt()
{
 .....
}

in showModalDialog calling function from parent

function child()
{
       if(window.dialogArguments) //for IE          
       {
             dialogArguments.parnt();
        }
        else if(window.opener) //for other Browsers
        {
            window.opener.parnt();
        }
}

Upvotes: 0

Kashif
Kashif

Reputation: 38

1)define document.ready function in one.js and while directing back 2)From two.js pass the relevant parameters In the document.ready of one.js 3)Based on whatever you got from two.js after validation call the function of one.js and perform remaining processing

Upvotes: 0

Related Questions