Jump to content

Recommended Posts

Posted

Hi all,

I'm trying to set the value of an object on a web page. The object, however, is not specified in the original source, but is referenced in a separate aspx by way of an iFrame. If I open the separate aspx that contains the object in another window, I can interact with it, but how do I get the info I set in it back to the original window?

Here's the reference to the iFrame from the original window's source:

<IFRAME title="DemoIFrame" id="DemoIFrame" onload="DemoIFrameOnLoad(this);" name="DemoIFrame" src="http://localhost/WebFormDemo.aspx"
frameBorder="no" height="1500" style="WIDTH: 100.0%; BORDER-RIGHT: thin inset; BORDER-TOP: thin inset; BORDER-LEFT: thin inset; BORDER-BOTTOM: thin groove;"></IFRAME>

Within the WebFormDemo.aspx source, a table contains the id to the object that I can then interact with:

id="DropDownPatType"

So, if I open the iFrame in a second window and interact with the object, how do I get that information back to the original window so I can continue interacting with the original webpage?

Posted

Unfortunately, the URL is internal, so posting it won't really help ;)

Here's something I've been trying, but I haven't had much luck with it...

$oIE =   _IEAttach("example"); - I opened the webpage already, so I can just attach to it
$propIE =  _IEPropertyGet($oIE, "locationurl")
$newProp = StringReplace($propIE, "example.aspx", "WebFormDemo.aspx")
$oIE1 =  _IECreate($newProp)
_IELoadWait($oIE1)
$err = _IEHeadInsertEventScript($oIE1, "window", "onchange", "DemoIFrame.GetGroupInfo()")
$oPropTxt = _IEGetObjByName($oIE1, "txtDropDownPatType")
$oProp =  _IEGetObjByName($oIE1, "DropDownPatType")
_IEFormElementSetValue($oPropTxt, "02", 1)
_IEFormElementOptionSelect($oProp, "Setting2", 1, "byText", 1); Apply Changes To Listbox
$oForm =  _IEFormGetObjByName($oIE1, "WebFormDemo")
;$oForm.document.parentwindow.execScript("SynchDemo()","javascript")
_IEQuit($oIE1)
Posted

Ok, if I reference the frame, how do I then reference the object that I need to interact with? Would the id of the object from the other aspx function this way? Thanks

Posted

Ok, I've been able to set the control values in the separate window, however I'm not entirely sure how to get these values passed back to the original window. There's a javascript command that I'm trying to use to do this, but I'm not sure if it'll do what I need...

_IEErrorHandlerRegister()
$oIE =   _IEAttach("example")
$oIFrame =  _IEGetObjByName($oIE, "DemoIFrame")
$oIE1 =  _IECreate($oIFrame.src)
$oProp =  _IEGetObjByName($oIE1, "DropDownPatType")
_IEFormElementOptionSelect($oProp, "Setting2", 1, "byText", 1); Apply Changes To Listbox
$oIE1.document.parentwindow.execScript($oIE&".SynchDemo(txtDropDownPatType)","javascript")
Exit
Posted

Searching around, I found a reference to "window.top.document.myvariable". Am I on the right track with this type of command? I'm not quite sure where to go from here. How would I be able to get the element id/name from the separate iFrame and use it on the main IE object?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...