CyberGuru Posted June 23, 2011 Share Posted June 23, 2011 not sure if this is the right place for this.... I have a php page that contains a div with a php page inside the div. On the page inside the div, when I click on a link I need it to change the value of a text box on the parent page. All my attempts at this so far have been unsuccessful. Can anyone point me in the right direction of how to accomplish this? Thanks for any input and help. Quote Link to comment https://forums.phpfreaks.com/topic/240173-php-inside-of-div-tag-not-passing-value-to-parent-page/ Share on other sites More sharing options...
kenrbnsn Posted June 23, 2011 Share Posted June 23, 2011 If you don't post your code between tags, nobody will be able to help you at all. Ken Quote Link to comment https://forums.phpfreaks.com/topic/240173-php-inside-of-div-tag-not-passing-value-to-parent-page/#findComment-1233663 Share on other sites More sharing options...
CyberGuru Posted June 23, 2011 Author Share Posted June 23, 2011 on the embedded page I am using the following javascript to change the contents of a text field on the parent page when a link is clicked. However when I click the link the error I receive is the function change_text is not defined. function change_text() { message.value = "text to be changed to"; } Quote Link to comment https://forums.phpfreaks.com/topic/240173-php-inside-of-div-tag-not-passing-value-to-parent-page/#findComment-1233676 Share on other sites More sharing options...
fugix Posted June 23, 2011 Share Posted June 23, 2011 You aren't telling the browser where to change the field value. You need something like function change_text { var message = document.getElementById("message"); message.value = "test message"; } Quote Link to comment https://forums.phpfreaks.com/topic/240173-php-inside-of-div-tag-not-passing-value-to-parent-page/#findComment-1233681 Share on other sites More sharing options...
Adam Posted June 23, 2011 Share Posted June 23, 2011 If the function isn't defined then it's either out of scope for the content within the DIV, or you're not correctly including it. All we can see is the definition of the function, which doesn't explain why it's not working with the rest of the page. Can you post the whole source? Quote Link to comment https://forums.phpfreaks.com/topic/240173-php-inside-of-div-tag-not-passing-value-to-parent-page/#findComment-1233739 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.