ThunderAI Posted July 11, 2011 Share Posted July 11, 2011 I have a form in an iframe: action="_iframe_submitpoint_sn.php" method="post" target="formresults"> target="formresults" is an iframe within the iframe. On "_iframe_submitpoint_sn.php" I have a javascript function that is suppose to change the content of a field outside of the first iframe. What should that .GetElementID look like? I've tried Top, parent, but I can't seem to find the magical combination. Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/241635-form-submit-target-and-getelementid/ Share on other sites More sharing options...
nogray Posted July 11, 2011 Share Posted July 11, 2011 Since you are in an iframe within an iframe, you would need to create a few functions in the main page (outside the iframes), create a function that update the value ie function update_val(val) { document.getElementById('my_id').value = val; } in the first iframe window, you'll need to create a function that call the parnet update_val function. (function something(val) {parent.update_val(val);}) In the last iframe, you'll need to make a function that call that function. You also try to call parent.parent.update_val(val) from the inside iframe. Quote Link to comment https://forums.phpfreaks.com/topic/241635-form-submit-target-and-getelementid/#findComment-1241133 Share on other sites More sharing options...
ThunderAI Posted July 11, 2011 Author Share Posted July 11, 2011 Since you are in an iframe within an iframe, you would need to create a few functions in the main page (outside the iframes), create a function that update the value ie function update_val(val) { document.getElementById('my_id').value = val; } in the first iframe window, you'll need to create a function that call the parnet update_val function. (function something(val) {parent.update_val(val);}) In the last iframe, you'll need to make a function that call that function. You also try to call parent.parent.update_val(val) from the inside iframe. Can one assume that Parent.Parent.document.getelementbyID would not work and it has to be done via a function? Quote Link to comment https://forums.phpfreaks.com/topic/241635-form-submit-target-and-getelementid/#findComment-1241379 Share on other sites More sharing options...
nogray Posted July 11, 2011 Share Posted July 11, 2011 You can try and see if it works. I find it more reliable to create a function in the main page to alter the values. Quote Link to comment https://forums.phpfreaks.com/topic/241635-form-submit-target-and-getelementid/#findComment-1241514 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.