2
Hello.
That’s what the scope is.. I have a holder who can have n dependents. The related person in the sale uploads files from holder and dependent. Save a folder with the holder’s CPF number on the server and inside I follow the structure of saving the dependents' CPF with the documents.
I created a specific class to add the "documents" field in the form and it can include at most 3 fields for this upload;
For the holder, I have the function ready, however, on the part of dependents, I have a problem..
$(".adiciona").click(function(event)
{
var nId = event.target.id;
var sId = nId.split("_");
var id = sId[1];
var MaxInputs = 2;
var InputsWrapper = $("#InputsWrapper_"+id);
var AddButton = $("#AddMoreFileBox_"+id);
var x = InputsWrapper.length;
var FieldCount = 1;
if(x <= MaxInputs)
{
FieldCount++;
$(InputsWrapper).append('<div><input type="file" name="arquivoDep_'+id+'[]" id="field_'+id+'_'+ FieldCount +'"/> <a href="#" class="removeclass">Remove</a></div>');
x++;
$("#AddMoreFileId_"+id).show();
$('AddMoreFileBox_'+_id).html("Adiciona Documento");
if(x == 3) {
$(AddMoreFileBox_+_id).hide();
$("#lineBreak").html("<br>");
}
}
return false;
});
Fields are added in the right Divs, but none of the counters work and I can’t control how many documents are being sent.
https://jsfiddle.net/9w7maLe1/
Some help on how to solve?
From now on, thank you.