There is a problem with the JS code for data-max. I assume it wants to limit the maximum fields to something but fails. To fix this, replace
var countFormGroup = .... ;
with
var countFormGroup = function ($form) {
return $form.siblings('.form-group').andSelf().length;
};
also, replace
var $lastFormGroupLast = ... ;
with
var $lastFormGroupLast = $multipleFormGroup.siblings('.form-group:last').andSelf();
Also, add the data-max attribute to the .mutliple-form-group.
Rodney Pantonial () - 9 years ago - Reply 0
Great Job !!
Unfortunately I don't know javascript but I have two questions:
1. how can I put a limit to the number of fields to be created. I would like to limit it to e.g. 8
2. Ist there is a possibilty to delete "used option" from selection ? E.g. If phone was already provided "phone" label shouldn't be available if I add new fields.
Thank you.
quabs () - 10 years ago - Reply 0
Please check out similar snippets on this site, there are some that have the functionality you are talking about :)
maxsurguy () - 10 years ago - Reply 0
Thank you could't find any but I'm focusing on a different solution.
Just one question: What does this line says: <input type="hidden" class="input-group-select-val" name="contacts['type'][]" value="phone">
I'm trying to find out this line is acutually used for expected for design purpose .
quabs () - 10 years ago - Reply 0
Hi guys,
Recently I did use this snipped, thanks a lot for it!
I'd like to notice one issue in JS code, after line #16 you should paste
$formGroupClone.find('.input-group-select-val').text('phone');
Otherwise newly created inputs comes with empty type. Also I did my own parser for php side, it is very simple and I'd like to share it
Thanks :)
Igor Vovk () - 10 years ago - Reply 0
I apologize for my English, I write very bad. To work with an I use the function
Maxim Kostjukevich () - 10 years ago - Reply 0
any clue on after serializing the form, how to access the values in php side?
Behzad () - 10 years ago - Reply 0
I believe you can access the array to retrieve them. What framework/script do you use to retrieve input elements?
maxsurguy () - 10 years ago - Reply 0