Hi, again
Now and after I had tried many solutions, I am able to set default values of the form fields.
so when I enter to adding new record page I get default values of the last record as the image illustrates.
the changes made in the script are:
<script type="text/javascript">
$(document).ready(function(){
$("#id_PUITS").change(function(){
var url = $("#SurveillanceDesPuits_F").attr("data-record-url");
var PUITSId = $(this).val();
$.ajax({
type: 'GET' ,
url: url,
data: {
'PUITS': PUITSId
},
success: function (data){
$('#SurveillanceDesPuits_F').html(data);
}
});
});
});
</script>
the results are good and the script calls the new data but with some problems.
so after I select a Well ID the code load the new data but it duplicates some elements, see the above pic.
2nd problem is it doesn’t keep the selected Well ID in the choice field.
how could I fix that?
All my best

