473,382 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

change text field from within an iframe

hi

i am trying to change the value of a text field on my page dynamically,
every time an iframe loads.

#==========

the code where the text field is looks like this:

<form name="test_form">
<input type="text" name="test_field" value="initialized" />
</form>

#==========

the iframe is embedded like this:

<iframe src="iframe_content.php" name="page" />

#==========

and the iframe_content.php site does this, before it gets to the <html> tag:

<script language="javascript">
document.parent.test_form.test_field.value = 'page X loaded';
</script>

#==========

i also have tried "frames[0]" and "parent" instead of "top". no success.
what i want it to do is, as soon as he iframe_content.php site loads, the
text field (test_field) should show "page X loaded", where "X" is a value
that's being dynamically set.
the problem is, that it doesn't do that. any ideas on what i would have to
change?

thanks a lot in advance!
sid
Mar 31 '06 #1
4 6114
sid derra wrote:
hi

i am trying to change the value of a text field on my page dynamically,
every time an iframe loads.

#==========

the code where the text field is looks like this:

<form name="test_form">
<input type="text" name="test_field" value="initialized" />
</form>

#==========

the iframe is embedded like this:

<iframe src="iframe_content.php" name="page" />

#==========

and the iframe_content.php site does this, before it gets to the <html>
tag:

<script language="javascript">
document.parent.test_form.test_field.value = 'page X loaded';
</script>

#==========

i also have tried "frames[0]" and "parent" instead of "top". no success.
I guess you made a typo here because it still says parent.

did you try:
parent.frames["page"].document.forms["test_form"].test_field.value= ...

Regards,
Erwin Moller
what i want it to do is, as soon as he iframe_content.php site loads, the
text field (test_field) should show "page X loaded", where "X" is a value
that's being dynamically set.
the problem is, that it doesn't do that. any ideas on what i would have to
change?

thanks a lot in advance!
sid


Mar 31 '06 #2

"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:44***********************@news.xs4all.nl...
sid derra wrote:
i also have tried "frames[0]" and "parent" instead of "top". no success.
I guess you made a typo here because it still says parent.


in fact, i did ;-)
did you try:
parent.frames["page"].document.forms["test_form"].test_field.value= ...
i did now, no luck though unfortunately. the html source now says

<script language="javascript">
parent.frames["page"].document.forms["test_form"].test_field.value = 'page X
loaded';
</script>
Regards,
Erwin Moller


still - thank you!
Mar 31 '06 #3
sid derra wrote:

"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:44***********************@news.xs4all.nl...
sid derra wrote:
i also have tried "frames[0]" and "parent" instead of "top". no success.


I guess you made a typo here because it still says parent.


in fact, i did ;-)
did you try:
parent.frames["page"].document.forms["test_form"].test_field.value= ...


i did now, no luck though unfortunately. the html source now says

<script language="javascript">
parent.frames["page"].document.forms["test_form"].test_field.value = 'page
X loaded';
</script>
Regards,
Erwin Moller


still - thank you!


Ok, do you get any securityalerts?
Check this by visiting your website with firefox and open the
javascript-output.

Are you maybe trying to set something in a different domain?
I mean, does the html in both pages (the original and the one in the Iframe)
come from the same domain???

Regards,
Erwin Moller
Apr 4 '06 #4
"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:44***********************@news.xs4all.nl...
sid derra wrote:

"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:44***********************@news.xs4all.nl...
sid derra wrote:
i also have tried "frames[0]" and "parent" instead of "top". no
success.

I guess you made a typo here because it still says parent.


in fact, i did ;-)
did you try:
parent.frames["page"].document.forms["test_form"].test_field.value= ...


i did now, no luck though unfortunately. the html source now says

<script language="javascript">
parent.frames["page"].document.forms["test_form"].test_field.value =
'page
X loaded';
</script>
Regards,
Erwin Moller


still - thank you!


Ok, do you get any securityalerts?
Check this by visiting your website with firefox and open the
javascript-output.

Are you maybe trying to set something in a different domain?
I mean, does the html in both pages (the original and the one in the
Iframe)
come from the same domain???

Regards,
Erwin Moller


thanks erwin (do you speak german?)

yes, both the code fragments come from the same domain - in fact, they are
all generated by the same php file.
i'll check out the firefox security console...

sid
Apr 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthew Sickler | last post by:
I have a text field that contains abstract information formated in HTML, I'd like strip the HTML and insert the data in another Text field within a DTS package. Is this possible? any...
2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
1
by: Barry | last post by:
Retoring Caret Position after text field correction -------------------------------------------------------------------------------- Hi, my code has the following form - function...
1
by: J Talbot | last post by:
Hi Was wondering if anyone could help me with this problem : If I have three checkboxes with different values on a form like : <input type="checkbox" name="checkbox" value="1stValue">...
4
by: sparks | last post by:
Well I have an old database that all the text fields are set to 25-50 don't know why but I needed to change them all to 250. Well I wrote some code to change the size of the fields in the tables...
2
by: mandarchalke29 | last post by:
Dear sir, Can anyone please tell me how to add an hidden field on IFRAME. The IFRAME is not added in Form. its just a frame can i add like this? <iframe id="thread" name="thread"...
1
by: barbara_dave | last post by:
Hi all, I want to change a field data type from Text to Memo.The reason is I need to type more text in that field. when I was saving the change I got error message "The width of a Unicode...
3
by: dugald.morrow | last post by:
I have some javascript that updates the text in a text field after certain actions take place such as clicking a checkbox. The javascript works fine in Safari and Firefox, but in IE, the text in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.