Saving a form
by Matt Rummler
HTML
<section id="fileSection" class="center-block">
<form id="fileForm" class="hidden" >
<button id="fileClose" type="button" class="close"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<fieldset id="Record">
<legend id='fileLegend'>
File
<!--<a href="/applicationform.html#fileForm">File</a>-->
</legend>
<input id="formName" type="hidden" name="formName" value="Record">
<ul class="unmarkedList">
<li id="fileNumberData">
<label for="Record_ID" data-inline="true">
File Number:
</label>
<input id="Record_ID" name="Record_ID" type="text" readonly>
</li>
<li id="fileNameData">
<label id="fileNameDataLabel" for="Record_Name">
File Name:
</label>
<input id="Record_Name" type="text" name="Record_Name" value="" required autofocus>
</li>
<li id="fileDescData">
<label id="fileDescDataLabel">
File Description:
</label>
<!--use this to apply some default bootstrap styling class="form-control"-->
<br/><textarea rows="3" id="Record_Description" name="Record_Description" contenteditable="true"> this is in the text area and should ikely dissapear</textarea>
<div contenteditable="true" class="cke_textarea_inline cke_editable cke_editable_inline cke_contents_ltr cke_show_borders" tabindex="0" spellcheck="false" role="textbox" aria-label="Rich Text Editor, Record_Description" title="Rich Text Editor, Record_Description" aria-describedby="cke_67" style="position: relative;"><p>this is in the div and should show up in the textarea<br></p></div>
</li>
<li>
<label...
JavaScript
//var formTextAreas=$('#'+formName+'textarea');
var formName='fileForm';
$('#saveFile').on("click", function()
{
// alert('The Save File button has been clicked!!!!');
var divContents=$('#'+formName+' [class^=cke_textarea_inline').html();
alert('The following is the divContents: '+divContents);
var textArea=$('#'+formName+' textarea');
alert('The following is what is in the textArea: '+textArea.text());
textArea.val(divContents);
//textArea=$('#'+formName+' textarea').val(divContents);
//alert('The contets of the div: '+$('#'+formName+' [class^=cke_textarea_inline').html());
});