Adding text fields dynamically using Javascript is not saving to database
Confluence User - 05 Sep, 2018
Hi
I am using Joget V6 community version.
My requirement is to add/remove text fields dynamically .
So i have used custom HTML and used following code. But it is not saving to database.
Could anyone help me on this.
<div class="container1"> <button class="add_form_field">Add New Field <span style="font-size:16px; font-weight:bold;">+ </span></button> <div><input type="text" name="mytext[]"></div> </div>
And in another custom HTML i have used javascript
<script type="text/javascript">
$(document).ready(function() {
var max_fields = 10;
var wrapper = $(".container1");
var add_button = $(".add_form_field");
var x = 1;
$(add_button).click(function(e){
e.preventDefault();
if(x < max_fields){
x++;
$(wrapper).append('<div><input type="text" name="mytext[]"/><a href="#" class="delete">Delete</a></div>'); //add input box
}
else
{
alert('You Reached the limits')
}
});
$(wrapper).on("click",".delete", function(e){
e.preventDefault(); $(this).parent('div').remove(); x--;
})
});
</script>
But this is creating fields properly and upon submitting it is showing as "Form submitted' But table is not created
forms