472,348 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Gathering data from form fields within iFrames

Jon
All,

I'm currently working with a PHP-based CMS application, and am begining to
put the finishing touches on it via Javascript validation. Currently, I'm
using fairly standard methods of validation of each form field, the
algorithm is much like:

if(document.formName.field.value == ""){
//throw an error and return false
}

This works great except for one particular field. I have a javascript-based
Rich Text Editor (RTE) that currently places the body of each page within an
iFrame. When the page loads, I populate a field within the iFrame that is a
textarea with data coming from the DB (MySQL). All works fine this way, and
when the user makes a change and clicks submit, I'm able to get that data
from the form and submit.

The problem comes up with two things - building a preview page, and
validating data within the field. The algorithm I'm using above will work
within the field, however it will only give me the ORIGINAL value of the
textarea field. If the user changes it, I'm simply unable to grab the NEW
value of the field. As all of my other field validation works fine, I'm
assuming this has something to do with the iFrame.

So, can anyone give me some info on how I can grab CURRENT values of a
textarea field within an iFrame? Currently, any changes made within the
textarea (inside the iFrame) simply are not recognized by normal javascript
Validation. I'm somewhat of a JS newb, but can work off any any algorithm -
so at this point, ANY help is appreciated. Thank you in advance.
Jan 25 '06 #1
2 2217
Jon wrote:
if(document.formName.field.value == ""){
//throw an error and return false
}

The algorithm I'm using above will work within the field,
however it will only give me the ORIGINAL value of the
textarea field. If the user changes it, I'm simply unable to grab the NEW
value of the field. As all of my other field validation works fine, I'm
assuming this has something to do with the iFrame.


Jon,

The only thing I can think of is that you are accessing the wrong
document. An iframe has its own document object - I believe the
property is called contentDocument, but I am not sure, so don't flame
me if I'm incorrect. Anyway, you might want to try getting the form in
that document object and see if that helps.

--
Joe Attardi

Jan 25 '06 #2
Jon
hehe - I don't flame on newsgroups or message boards :p

Thanks for the info - Though I was unable to build a solution exactly how I
wanted originally, I researched what you were talking about and found a
better way. I basically built the 'preview' functionality within the iFrame
itself to avoid any problems of the different objects on the same page. So
it calls the ID of the textarea from a link that sits inside the actual
iFrame, and pushes the current value to a new window. Looks to be working
fine now - Thanks :)

I really need to take some Javascript classes - it's much different than
what I'm used to (PHP/ASP) :(

"Joe Attardi" <ja******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Jon wrote:
if(document.formName.field.value == ""){
//throw an error and return false
}

The algorithm I'm using above will work within the field,
however it will only give me the ORIGINAL value of the
textarea field. If the user changes it, I'm simply unable to grab the NEW
value of the field. As all of my other field validation works fine, I'm
assuming this has something to do with the iFrame.


Jon,

The only thing I can think of is that you are accessing the wrong
document. An iframe has its own document object - I believe the
property is called contentDocument, but I am not sure, so don't flame
me if I'm incorrect. Anyway, you might want to try getting the form in
that document object and see if that helps.

--
Joe Attardi

Jan 25 '06 #3

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

Similar topics

5
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam...
5
by: Ben | last post by:
Hi, I'm having trouble with the CSS apparently not working fully on the form input fields when inside an iFRAME. The problem is that if I resize...
5
by: Victor | last post by:
Hi I need to open an html file from the file system and embed that html file within my main aspx form. I have 2 questions: 1) How do I open the...
1
by: junkaccount | last post by:
In Access 2000, I want to create a form that upon initial data entry, matches data from one table and places it in the form. The user will then...
9
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The...
23
by: Bjorn | last post by:
Hi. Every time i post data in a form the contents are being checked for validity. When i click the back-button, all data is gone and i have to...
4
by: vunet.us | last post by:
Hi all, I am converting my app to AJAX-based. I have a form that submits some data including images. When I use AJAX XmlHttpRequest I am unable to...
2
by: shankar2 | last post by:
Hello All, This is my first try at posting a query in this forum, your patience is appreciated. App Details: Access 2000 on Win 2000, Slightly...
1
by: filmfanatic | last post by:
In this emal form, I'm trying to consolidate all the input into the TEXTAREA portion and then have it emailed to a specific person. I've tried the...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.