PageSourceSearch

https://www.robindestoits.org/js/_form_mail_check.js

js robindestoits.org collected 2026-10-01 11:43:06 UTC 3,464 bytes, 116 lines download raw bytes

1	$('#erreurForm').css('color','#FF0000');
2	$('#contact_form').on('keypress', function() {
3		$('#contact_form input,#contact_form textarea,#contact_form select').removeClass('form_error');
4	});
5
6	function showFormError(message) {
7		$('#erreurForm').text(message).show();
8		$('html, body').animate({ scrollTop: $('#erreurForm').offset().top - 20 }, 300);
9	}
10
11	function verifForm(){
12	var type_compte = $('#id_type').val();
13	$('input,select,textarea').removeClass('form_error');
14	$('.help_mess').hide();
15	$('#erreurForm').hide().text('');
16
17	var groupeVal = $('#groupe_rt').val();
18	var delegationVal = $('#delegation_rt').val();
19	var selectedOne = (groupeVal !== null && groupeVal !== '') || (delegationVal !== null && delegationVal !== '');
20
21	if (!selectedOne) {
22		$('#groupe_rt, #delegation_rt').addClass('form_error');
23		showFormError('Veuillez sélectionner un groupe ou une délégation.');
24		$('#groupe_rt').focus();
25		return false;
26	}
27
28	if (/^\s*$/.test($('#nom_client').val())){
29		$('#nom_client').addClass('form_error');
30		showFormError('Veuillez saisir votre nom.');
31		$('#nom_client').focus();
32		return false;
33	}
34	
35	if (/^\s*$/.test($('#prenom_client').val())){
36		$('#prenom_client').addClass('form_error');
37		showFormError('Veuillez saisir votre prénom.');
38		$('#prenom_client').focus();
39		return false;
40	}
41
42	if (/^\s*$/.test($('#email_client').val())){
43		$('#email_client').addClass('form_error');
44		showFormError('Veuillez saisir votre email.');
45		$('#email_client').focus();
46		return false;
47	}
48
49	if(($('#email_client').val().indexOf('@',0)==-1) || ($('#email_client').val().indexOf('.',0)==-1)) {
50		$('#email_client').addClass('form_error');
51		showFormError('Veuillez entrer une adresse email valide.');
52		$('#email_client').focus();
53		return false;
54	}
55
56	if (/^\s*$/.test($('#tel_client').val())){
57		$('#tel_client').addClass('form_error');
58		showFormError('Veuillez saisir votre téléphone.');
59		$('#tel_client').focus();
60		return false;
61	}
62	var chaine = $('#tel_client').val();
63	var tel_ok = chaine.replace(/[ -.]/g,"");
64	if(tel_ok.length < 10){
65		$('#tel_client').addClass('form_error');
66		showFormError('Votre téléphone est invalide.');
67		$('#tel_client').focus();
68		return false;
69	}
70	if(isNaN(tel_ok)) {
71		$('#tel_client').addClass('form_error');
72		showFormError('Votre téléphone ne doit contenir que des chiffres.');
73		$('#tel_client').focus();
74		return false;
75	}
76
77	if (/^\s*$/.test($('#message_client').val())){
78		$('#message_client').addClass('form_error');
79		showFormError('Veuillez préciser votre demande.');
80		$('#message_client').focus();
81		return false;
82	}
83
84	if($('#valide_rgpd').prop('checked')==false){
85		$('#valide_rgpd').addClass('form_error');
86		showFormError('Veuillez accepter la politique de confidentialité.');
87		$('#valide_rgpd').focus();
88		return false;
89	}
90
91	return true;
92	}
93	
94function gestionSelectionGroupeDelegation() {
95    $('#groupe_rt, #delegation_rt').on('change', function () {
96        var currentId = $(this).attr('id');
97        var otherId = (currentId === 'groupe_rt') ? '#delegation_rt' : '#groupe_rt';
98
99        if ($(this).val() !== '') {
100            $(otherId).val('');
101        }
102    });
103}
104
105$(document).ready(function () {
106    gestionSelectionGroupeDelegation();
107});
108
109function viderForm () {
110  $(':input','#contact_form')
111   .not(':button, :submit, :reset, :hidden, input[type=radio], select')
112   .val('')
113   .removeAttr('checked')
114   .removeAttr('selected');
115   $("#valide_rgpd").prop('checked', false); 
116}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.