RE: AutoSave function?

2011-01-06 Thread Justin Scott

> I have a form with MANY TEXTAREA elements. Once a user
> decides to update the text within any of the fields,
> I want to fire off an "autosave" type function for the
> single item.

You might try serializing the textarea value into a JSON object and posting
that in the background to your autosave engine via form POST rather than a
GET operation.  You could also use something like jQuery to do an ajax-style
call instead of a direct URL call (i.e. so you don't have to pass the data
on the URL).  The downside is that CF7 doesn't have the JSON functions
built-in to parse it back out, but it shouldn't be too difficult to parse
manually since the format should always be the same.


-Justin



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340504
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


AutoSave function?

2011-01-06 Thread ColdFusion Developer

Let me start by saying I have to do this using CFMX 7. (CFMX 8 and 9 is not
an option right now).

I have a form with MANY TEXTAREA elements. Once a user decides to update the
text within any of the fields,
I want to fire off an "autosave" type function for the single item.

So far it is working well in using JS and HTTP.OPEN request and the actual
TEXT is part of the URL scope.

ex: http.open('get','/autosave.cfm?id=1000&comment=this is my comment that I
want to save. This should be on the next line.');

It works very well BUT I lose the actual formatting of TEXT. It basically
becomes a single line as:

"this is my comment that I want to save. This should be on the next line."

instead of:

"this is my comment that I want to save.
This should be on the next line."

Items I have looked at are: using the JS escape() and unescape() functions
to populate the URL variable since it is built via JS.

I tried naming the main window such as:  myWin  and using JS on the
autosave.cfm file to obtain the value of the textarea field such as:
window.myWin.getElementById('mytxtfield').value and set that to a hidden
form field then do a dynamic form submission in thought that
I could maintain the formatting of the original text. But in this instance,
it indicates that "window.myWin" is not an object or is null.

I have verified that the window is being named as "myWin" (and spelled
correctly and used the same upper/lower case).

In lieu of just popping up a window with the textarea for the given field
and then saving it to the DB, then running a JS function to copy
the new text back to the parent window, is there another option to do inline
autosaves within CFMX 7?

Hopefully that made some sense as I can ramble at times.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340502
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm