Solved

RTE getting value from iframe when form is submitted

Posted on 2007-03-28
8
271 Views
Last Modified: 2008-02-01
ive created my own simple RTE using an iframe and the execCommand() functions.

i can format text and have it show in the iframe, but when i click submit to extract the formatted text, the  POSTed data is blank.

how does this work for the Rich Text Editors on likes of gmail, myspace etc etc?

my iframe:

<iframe id="data" name="data" width="99%" height="200px"></iframe>
0
Comment
Question by:ellandrd
  • 4
  • 3
8 Comments
 
LVL 20

Expert Comment

by:steelseth12
ID: 18808246
gmail uses ajax.

have a look at http://www.prototypejs.org/ 
0
 
LVL 29

Accepted Solution

by:
rdivilbiss earned 500 total points
ID: 18808620
Ajax doesn't do a thing if you have no data to submit.  Why is every answer this year take one aJAX and call me in the morning.

Okay, an iframe isn't a form field.

Are you extracting the text from the iframe and putting it a field before submitting?

Say:

function mySubmit() {
     var text = document.getElementById('data').innerHTML;
     document.getElementById('hiddenFormField').value = text;
     document.form.submit();
}

The contents of the iframe wouldn't be sent by a form submit.

Regards,
Rod
0
 
LVL 16

Author Comment

by:ellandrd
ID: 18808684
>>Are you extracting the text from the iframe and putting it a field before submitting?

yes ive created a hidden textarea that gets updates as user types into the iframe.

after seeing your exmaple code, i see how its done...

thanks rod
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18809359
Great, glad to help.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Author Comment

by:ellandrd
ID: 18809377
ya its working nicely now too...
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18810677
Cool. Going to give it away, LOL.

Why is everyone always building a new RTE?  Or did I ask that before <smile>
0
 
LVL 16

Author Comment

by:ellandrd
ID: 18814291
you've probably asked me this before...  heres my reasons:

no particular order...

1) im a self learner so trying to write small apps helps me understand how the functionality and how the components all work together.

2) resorting to use somebody else code/web application will never make me a good programmer.

3) i think the RTE's that are available to d/l from the web contain too much cr*p like smiley faces for example or they are coded poorly with redundant code...  

4) some generate code that is impossible to validate or not compliant... for example mixed tags...

5) i like to be the author
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18815937
LOL, you sound like me...Go get 'em then.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now