Reputation: 1267
I would like to pass a value into a jquery dialog. For several reasons the page is in iFrames. The process starts with firing this function from a page within an iframe:
<Tr onclick="fireOpen1(true,myValue)">
here is the function (within the iframe page):
function fireOpen1(redirect,theValue) {
//here are two of the ways I have tried tp pass the value, neither work
parent.document.getElementById('theID').value = theValue;
parent.document.theForm('theID').value = theValue;
parent.openDialog1();
if (redirect) {
//do a redirect of the parent here
window.location.href = "left.asp";
}
}
which calls the opener on the parent page:
function openDialog1() { // called by the inner iframe
$('#dialog1').dialog({
show: "fold",
hide: "explode",
width: 600,
height: 200,
buttons: {
Close: function () {
$(this).dialog("close");
}
}
});
}
and here is my div with the contents of the dialog:
<div id="dialog1" >
<form name="theForm" action="frames.asp" method="post">
<input type="hidden" name="theID" value="0">
</form>
the id is <%= request.form("theID") %> ...
</div>
The dialog shows no problem but my value is not available. How can I pass this value. My reason for using this method is because I wanted to detach the dialog from the opener so its can remain there when the opener redirects. Thanking you
Upvotes: 0
Views: 707
Reputation: 5817
You can execute parent.$('#dialog1').data('v', myValue);
just before parent.openDialog1();
and then access it in dialog open event
as such var v = $('#dialog1').data('v');
Upvotes: 0
Reputation: 40639
You have missed the id in input field
<input type="hidden" name="theID" value="0">
should be
<input type="hidden" name="theID" id="theID" value="0">
Upvotes: 1