View Full Version : Recall Form Values script II - use with <textarea> ...?

12-13-2006, 10:04 AM
Recall Form Values script II


I'd like to get this working with some <textarea> values.

Due to the layout on my page, I can't use the <input type ="text"> method, I need to set up a "textarea" type input instead.

Is it possible to amend the above script to include <textarea> values or is there a way I can copy my textarea value into an input type="text" value, then recalling it later from the cookie - effectively copying it back into the <textarea> value back on the page...? :rolleyes:

Thanks in advance,


12-13-2006, 02:23 PM
The reason for the script not supporting the TEXTAREA element is because large amounts of text may be entered into it. The script relies on JavaScirpt cookies to save the information entered, which has a size limit of just 4kb per domain (all cookies added together). So it's not a good idea in general to use this script on textareas unless you have a way of enforcing the amount of text that gets entered by the user.

Having said that, you should be able to disable the script from checking the field type by removing the line:

if (this.fields[i].type=="text")

entirely, plus the part in red in the below:

if (cookievaluepair[i].split(":")[0]!="toggleboxid" && this.getfield(cookievaluepair[i].split(":")[0]).type =="text" )

12-14-2006, 10:18 AM
Thanks for the speedy reply.
Appreciate the reasons why you wouldn't use this 'normally' with <textarea> - it's just something I've got to do in isolation on a small intranet site .... as I can't, on this occasion, store responses to a db.

I wasn't aware there was a 4k limit (total) on cookies. Is this a 'default' thing or can this be fine tuned machine by machine. If so, I have a fixed/limited number of users utilising the Form and I could, possibly, enhance this for them???


12-14-2006, 11:07 AM
Nope, the cookie limit is hard coded into the browser, and most browsers have a 4kb limit I believe.