Hi all,
I've seen some questions on here regarding custom HTML input boxes not saving values. I believe we've found a very easy way to make this a reality. See the series of screenshots below (excerpt of Domestic No-Contact Order):
The Custom HTML for the block is:
<b>IT IS ORDERED THAT DEFENDANT IS PROHIBITED FROM:</b> <blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><ul><li>Causing or attempting to cause physical harm, bodicly injury, assault, including sexual assault, and from molesting, harassing, threatening, or stalking the protected person(s).</li> <li>Coming near and from having any contact whatsoever, in person or through others, by phone, mail or any means, directly or indirectly, except for mailing or service of process of court documents by a 3rd party or contact by defendant's lawyers with the protected person(s).</li> <li>Entering or knowingly coming within or knowingly remaining within <div id="txtDistancePlaceHolder">DISTANCE</div> (distance) of the protected person(s)'s <div id="chkBoxes"></div></li></ul></blockquote>
The important lines to notice above are:
<div id="txtDistancePlaceHolder">DISTANCE</div>
and
<div id="chkBoxes"></div>
Once those locators are put into place we use JavaScript to move the input fields above the block into the text block:
$(document).ready(function(){ //MOVE THE DISTANCE FIELD //Find the controls var divDist = $('#txtDistancePlaceHolder'); var txtDist = $('#q33 DIV.cf-field INPUT, #q33 DIV.cf-field SPAN');//Search for INPUT or SPAN, SPAN is used for display //Remove the textbox from its current location txtDist.remove(); //Insert it after the place holder txtDist.insertAfter(divDist); //Remove the place holder divDist.remove(); //Hide the old distance label $('#q33').hide(); var chkTarget = $('#chkBoxes'); var chkSource = $('#q34 DIV.cf-field DIV'); chkSource.remove(); chkSource.insertAfter(chkTarget); chkTarget.remove(); $('#q34').hide(); });
The end result when filling out this form is:
And the final result when storing the form is:
I wouldn't have been able to produce this on my own, and I'd like to thank Michael Mathys, our Director of Development here at Cities Digital for helping to make this a reality.