Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to select contents of form cftextarea after submitting form

New Here ,
Mar 26, 2010 Mar 26, 2010

I was wondering what is the way to select the contents of a cftextarea after submitting a cfform and that same page gets reloaded with cfform preservedata="yes".

397
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2010 Mar 26, 2010

If I try adding something like the following:

onLoad = "selectText();"

as an attribute of <cfform>, then the form doesn't display.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2010 Mar 26, 2010

This is true if you leave out the semicolon also:

<cffrom ... onLoad = "selectText()">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2010 Mar 26, 2010

I am able to add onload to body tag, but I guess I have to look into how to select the text with a function when the form has preserveData enabled.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2010 Mar 27, 2010
LATEST

The Forta Blog, http://www.forta.com/blog/index.cfm/2008/2/15/ColdFusion-Rich-Text-Control-And-Safari mentioned that there is a FCKEditor which allows you to add rich text control using <cftextarea rightext="true">, but the biggest gotcha with this control is the FCKEditor didn't support Safari for ColdFusion 8, which is the version that I am using.

So I guess that there may be no way to access the cftextarea. When you look at the source page it is not visible, but you can see:

<script type="text/javascript" charset='utf-8'>

     document.write("<embed pluginspage='http://www.macromedia.com/go/getflashplayer' ");

      document.write("   id='fQuiz' ");
...

</script>

Where the id of the cfform is fQuiz.

I guess there is no way then to modify the code so that I can automatically select the text inside the cftextarea instead of having to manually do that everytime I submit the form.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources