Reputation: 103
Are there any tools for previewing a Django form as the user provides input?
I've checked around S/O and don't see anything other than using the built-in preview function after submission. That seems antiquated.
I know you can do it using Jquery for simple text fields (like this: http://volter9.github.io/Form-Preview/) but I'd like to do it with a wysiwyg editor like TinyMCE.
Any tips would be appreciated
Upvotes: 0
Views: 1149
Reputation: 2470
This is what you are looking for. it allows you to type in the first input and preview content in the second form input.
I also added the ability to preview the tinymce inputted data in a div via div_result
<div>
<label>Input1. your tinymce form input</label>
<input type="text" id="input1" value="">
</div>
</br>
<label>Input2</label>
<input type="text" id="input2" value="">
<div id='div_result'></div>
<script src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#input1").keyup(function () {
var value = $(this).val();
$("#input2").val(value);
$("#div_result").html(value);
});
});
</script>
Upvotes: 1