Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

RTE getting value from iframe when form is submitted

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
ellandrd
Asked:
ellandrd
  • 4
  • 3
1 Solution
 
steelseth12Commented:
gmail uses ajax.

have a look at http://www.prototypejs.org/ 
0
 
rdivilbissCommented:
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
 
ellandrdAuthor Commented:
>>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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
rdivilbissCommented:
Great, glad to help.
0
 
ellandrdAuthor Commented:
ya its working nicely now too...
0
 
rdivilbissCommented:
Cool. Going to give it away, LOL.

Why is everyone always building a new RTE?  Or did I ask that before <smile>
0
 
ellandrdAuthor Commented:
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
 
rdivilbissCommented:
LOL, you sound like me...Go get 'em then.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now