Search code examples
formsmootoolsclone

mootools clone form element


I cannot get a form to submit additional fields that have been cloned. When a form like the one below is submitted, it does not include the cloned form elements. Does anybody know why and how I can alleviate this issue.

<form>
    <table>
    <tr><td><input type="text" value="50" name="myvar[]" /></td></tr>

    <!-- This button will clone the previous set of form elements -->
    <tr><input type="button" value="Add New Line" onclick="this.getParent('tr').getPrevious('tr').clone().inject(this.getParent('tr'), 'before')" /></tr>
    </table>
</form>

Solution

  • Thanks for the comment but the form was meant to be an example not actually what I had. I looked back at the form and the top form element was inside the table and the bottom form element was outside of the table. I moved the top form element outside of the table and everything works perfectly.

    thanks,