I have a longer list of date fields as below
<input id="date_declaration8_185" activite_dmc8_id="386" class="form-control date_declaration8" name="date_declaration" type="text" value="">
<input id="date_declaration8_266" activite_dmc8_id="256" class="form-control date_declaration8" name="date_declaration" type="text" value="">
I would like to be able to recover the value of the attribute activite_dmc8_id and send with date
$('.date_declaration8').daterangepicker({
"opens": "center",
"drops": "up",
"singleDatePicker": true,
"showDropdowns": true,
"showWeekNumbers": true,
"maxSpan": {
"days": 7
}
}, function(start, end, label,) {
var id = $(this).attr('activite_dmc8_id');
dataString = {
id: id,
date_declaration: start.format('YYYY-MM-DD'),
rend_selected:$('#rend_selected8_'+id).val(),
quantite:$('#quantite8_'+id).val(),
valeur:$('#valeur8_'+id).val(),
notes: $('#notes8_' + id).val(),
num_parcelle: $('#num_parcelle8_' + id).val()
};
var message='';
$.ajax({
type: "POST",
url: "",
headers: {'X-CSRF-TOKEN': ''},
data: dataString,
cache: false,
success: function(xhr){
getChieldactiviteListeDMC();
new Noty({
type:"success",
layout:"topRight",
text:"Mise à jour ",
progressBar:true,
timeout:2500,
animation:{
open:"animated bounceInRight",
close:"animated zoomOutRight"
}
}).show();
},
error: function(xhr, status, error) {
var err = JSON.parse(xhr.responseText);
$.each(err.errors, function(name2, val2) {
message = message+"<br />"+val2;
});
new Noty({
type:"warning",
layout:"topRight",
text:"Hey this is an warning notification.",
progressBar:true,
timeout:2500,
animation:{open:"animated bounceInRight",close:"animated zoomOutRight"}
}).show();
}
});
});
I cannot use the field id, but I cannot get the value of activite_dmc8_id of the field calling datpicker
I imagine that you have to pass the value in parameterizing the function but I don't know how to do it
thank you for your help, I am struggling with this problem and cannot find a solution.
PS: Sorry for my approximate English
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire