0

I have an inline frame within a form. The inline frame actually contains the form element which is generated programatically (a radio which holds a value). How can I retrieve that value hold by the radio from the page which contains that inline frame. Any idea? thanks for reading

1
  • There are no php variables in the forms. Form values can be accessed via javascript May 28, 2010 at 17:09

2 Answers 2

2

What MvanGeest is suggesting is for you to use javascript to transfer values of the radio buttons to a hidden field in your main page form so for each radio button you would have onclick="valueSet(this.value)" and in the function valueSet (that you define in the iframe) you would set the value of the hidden form field

function valueSet(radioValue){
    window.parent.document.forms["nameOfYourForm"].elements["nameOfHiddenElement"].value = radioValue;
}

and in the main window, in the FORM you have
<input type="hidden" name="nameOfHiddenElement" value="" />

and you can set the default value for it as well

Don't forget to give your form a name attribute and use that name in the function where it references forms["nameOfYourForm"]

Does that make sense for your project? Or am I totally off base here?

0
1

This site explains about cross-frame access in JavaScript: http://www.west-wind.com/Weblog/posts/589454.aspx. Be aware that the same-origin policy is enforced; in other words, you cannot access a frame which contains a page loaded from another domain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.