Reference another floatbox

Page: 1

Author Post
Member
Registered: Oct 2009
Posts: 35
I have a page on an intranet, it opens a page with a form on it. This page has a link that opens another page, this page searches for addresses, and then needs to update the previous floatbox pages fields.

Previously I have updated a parent page from a floatbox by using this
parent.document.getElementById("address1").value = shpaddress1.value;


When I try this technique on the 2nd floatbox it fails with "Uncaught TypeError: Cannot set property 'value' of null", so I am assuming its trying to update the parent page that opened the first floatbox.

So, how do I reference the first floatbox from the second floatbox?

Cheers,

Steve
Member
Registered: Oct 2009
Posts: 35
I really should RTFM before posting!

I gave this a go

parent.fb.$("address1").value = shpaddress1.value;


And it worked as expected once I added the floatbox js to the second floatbox page.

Steve
Administrator
Registered: Aug 2008
Posts: 3382
This is great. All I have to do is go out for dinner, stay for an extra beer afterwards, and the forum problems answer themselves. Keep up the good work.

Not too long ago I updated the API Reference with what I think is a pretty good section on referencing particular floatboxes when more than one is open. Check it out. But the key thing to note in your circumstances is that fb.$ will poke into each same-domain child iframe that has floatbox.js loaded, including iframes showing in a floatbox, in its hunt for the requested id.
Member
Registered: Oct 2009
Posts: 35
I must have missed that part, I will go over and it make any additional changes. I was lucky that the elements I was updating were unique, if they on the parent page and first floatbox I could have run into problems.

Thanks again for everything!

Steve

Page: 1