I am working on a proof of concept for a Contract using Laserfiche forms. The idea is for the user to enter data fields and review the Terms & Conditions with the ability to 'markup' the text to add/remove text within the HTML field. I have this working and it's actually pretty nice! The only caveat is that the changes/markup do not save when the form is submitted to Laserfiche. I know this is an issue with using Javascript and Forms, but thought I would try my luck to see if anyone has any thoughts/ideas.
Form Example:
HTML for field:
<div id="textbody"><p>I am an editable text area</p></div>
Javascript to make field 'editable' Note: I am using ice.js for the contentEditable function - this js library applies the markup
//Begin editable text
$('.makeChanges').on('touchstart click', function ()//Makes the text editable when the user clicks the button
{
$('#Field31').show();
$.getScript('https://servername/Forms/js/ice.min.js', function ()
{
var tracker = new ice.InlineChangeEditor({
element: document.getElementById('textbody'),
handleEvents: true,
plugins: [
'IceAddTitlePlugin',
'IceEmdashPlugin',
{
name: 'IceCopyPastePlugin',
settings: {
preserve: 'p,a[href],span,[id,class]em,strong'
}
}
]
});
var user = $('.username input').val();//Gets the user-entered username
tracker.startTracking();
tracker.setCurrentUser({id: 1, name: user});
$('#Field63').on('blur', function() {
var user = $('.username input').val();
var changes = tracker.getChanges();
var time = changes['2'].time;
var type = changes['2'].type;
var userid = changes['2'].userid;
var username = changes['2'].username;
$('.changes textarea').val(type + " " + user + " " + time);//Adds change information to the .changes textarea field
});
});
});
//End editable text
I'm looking for a way to make these changes permanent on my form. I thought of maybe using a 'Done' button that would 'commit' the changes, but that still didn't display the changes when it is stored to Laserfiche. Any help is much appreciated!
Nate