A simple Form Builder using jQueryUI - Part 1
In this post, we will see how to implement jQuery and jQueryUI to create the first part of form builder. In this part, the form builder will be used to place fields in a column layout – specifically a two column layout.
Demo / Source-code here
<!-- droppable columns defined below-->
<td class="droppedFieldsColumn">
<div id="selected-column-1" class="droppedFields"></div>
</td>
<td class="droppedFieldsColumn" >
<div id="selected-column-2" class="droppedFields"></div>
</td>
</tr>
<tfoot>
<tr align="left">
<td colspan="3">
<input type="button" value="Preview" onclick="preview();"></input>
</td>
<tr>
</tfoot>
</table>
$(".fld").draggable({ helper: “clone”, stack: “#containerTable div”,cursor: “move” });
The “accept” option defines what draggable elements are allowed to be dropped in the column-DIVs. Applying “:not(.ui-sortable-helper)” prevents the drop when sorting the elements within the column-DIV. The elements are made sortable with the following lines:
Demo / Source-code here
Next>> Form Builder Part 2