Heh the array brackets got all messed up - replacing them with parentheses for readability:
We have some custom input fields for our documents that we would also like to autosave like csx does with title/tags/etc. so if there's some validation error or something the user's input is still there. I see on doc-create where you use autosave object from autosave.js with the fields in the constructor to be saved - properties is an array where we should be able to add our own fields that should be saved it seems from what I saw in autosave.js.
So I modified doc-create where autosave is being configured to add my custom field to the properties:
properties = ('jive-blah','authorshipPolicy', 'jive-tags', 'documentApprovers', 'documentAuthors', 'commentStatus');
properties = ('jive-blah','jive-tags');
where I have <input type="text" name="jive-blah" size="65" id="jive-blah"
When I load the page and enter input - I see in firebug that the s2 map from Draft.saveDraft.dwr has s2('jive-blah')="input I entered"; which is good but if I throw a validation error and the page reloads, the value is not restored in the field - it still just remains empty. s2(jive-tags) correctly restores to the tags fields so I'm not sure why my input field in the properties map is not being restored but jive-tags and all the other jive fields are. Any thoughts? nsSessionStore.js throws a lot of "component is not available" exceptions in firebug but since the tags and everything get saved, doubt it's related. I'm running csx 1.5. Thanks for any info.
I just upgraded to 1.8 and am still seeing the same thing. I copied over autosave.js to web-inf to add some alert debugging and see that savedraft/postdraft are being called correctly with my added property input value from jive-blah field (now just using autoSave.addProperty('jive-blah') in doc-create.ftl to add it). But still when I throw validation error to reload the page, the field is not being populated with the input correctly - or if I modify autosave.js and reload to get the "use recovered/delete draft" options and click use recovered so I call useDraft function, the extended property field is not populated correctly in that case either. Any advice - do I need to somehow call displayDraft explicitly or something to get it to populate the fields (but then why would useDraft fail since I think it uses displayDraft as well). Would appreciate any help - thanks.
Are you sure you're using autosave at the point when you click 'save'? I think what happens is that we do a post to the server, which then validates the data and either shows you a success or the error page, which is what I believe you're seeing. When you see the error page, Freemarker is actually looking to the action (not to autosave) to see what data was originally entered. I'd suggest modifying the action that lives behind doc-create.ftl, which I believe is DocCreateAction.java. In that class you'll want to add an instance variable and a matching getter and setter for the instance var.
Yeah I ended up just using the getters to populate the field on errors that refresh the page - I was just hoping to take advantage of autosave to try to keep things simpler but this will work just as well. Thanks.