<script>
function submitTarget(){
if($('#registration_student_pre_registration_last_school_attended').val() == ''){
$('#registration_student_pre_registration_last_school_attended').focus();
return false;
}
if($('#registration_student_pre_registration_registration_number').val() == ''){
$('#registration_student_pre_registration_registration_number').focus();
return false;
}
if($('#registration_student_pre_registration_last_name').val() == ''){
$('#registration_student_pre_registration_last_name').focus();
return false;
}
if($('#registration_student_pre_registration_first_name').val() == ''){
$('#registration_student_pre_registration_first_name').focus();
return false;
}
if($('#registration_student_pre_registration_birthday').val() == ''){
$('#registration_student_pre_registration_birthday').focus();
return false;
}
$('#target').submit();
}
$(document).ready(function () {
$('#otherResponsible').hide();
$('#registration_student_pre_registration_is_parntal_authority_father').val("1");
$('#registration_student_pre_registration_is_parntal_authority_mother').val("0");
$('#registration_student_pre_registration_responsible_of_schooling').on('change', function(){
if($('#registration_student_pre_registration_responsible_of_schooling').val() == 'AUTRE'){
$('#otherResponsible').show();
$('#registration_student_pre_registration_responsible_of_schooling_last_name').prop('required', 'true');
$('#registration_student_pre_registration_responsible_of_schooling_first_name').prop('required', 'true');
$('#registration_student_pre_registration_responsible_of_schooling_address').prop('required', 'true');
$('#registration_student_pre_registration_responsible_of_schooling_phone_number').prop('required', 'true');
$('#registration_student_pre_registration_responsible_of_schooling_post').prop('required', 'true');
$('#registration_student_pre_registration_responsible_of_schooling_location').prop('required', 'true');
}else{
$('#otherResponsible').hide();
$('#registration_student_pre_registration_responsible_of_schooling_last_name').prop('required', 'false');
$('#registration_student_pre_registration_responsible_of_schooling_first_name').prop('required', 'false');
$('#registration_student_pre_registration_responsible_of_schooling_address').prop('required', 'false');
$('#registration_student_pre_registration_responsible_of_schooling_phone_number').prop('required', 'false');
$('#registration_student_pre_registration_responsible_of_schooling_post').prop('required', 'false');
$('#registration_student_pre_registration_responsible_of_schooling_location').prop('required', 'false');
}
})
$('#registration_student_pre_registration_is_parntal_authority_father').on('change', function(){
if($('#registration_student_pre_registration_is_parntal_authority_father').val() == "1"){
$('#registration_student_pre_registration_is_parntal_authority_mother').val("0");
}else{
$('#registration_student_pre_registration_is_parntal_authority_mother').val("1");
}
})
$('#registration_student_pre_registration_is_parntal_authority_mother').on('change', function(){
if($('#registration_student_pre_registration_is_parntal_authority_mother').val() == "1"){
$('#registration_student_pre_registration_is_parntal_authority_father').val("0");
}else{
$('#registration_student_pre_registration_is_parntal_authority_father').val("1");
}
})
})
</script>