Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
If I try adding something like the following:
onLoad = "selectText();"
as an attribute of <cfform>, then the form doesn't display.
Copy link to clipboard
Copied
This is true if you leave out the semicolon also:
<cffrom ... onLoad = "selectText()">
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.