Line 25... |
Line 25... |
25 |
// Affiche un retour visuel dès que input:file change
|
25 |
// Affiche un retour visuel dès que input:file change
|
26 |
$fileInput.change( function( event ) {
|
26 |
$fileInput.change( function( event ) {
|
27 |
// Il est possible de supprimer un fichier
|
27 |
// Il est possible de supprimer un fichier
|
28 |
// donc on vérifie que le 'change' est un ajout ou modificationis-defaut-value
|
28 |
// donc on vérifie que le 'change' est un ajout ou modificationis-defaut-value
|
29 |
if( !$.isEmptyObject( event.target.files[0] ) ) {
|
29 |
if( !$.isEmptyObject( event.target.files[0] ) ) {
|
- |
|
30 |
|
30 |
var file = event.target.files[0],
|
31 |
var file = event.target.files[0],
|
- |
|
32 |
fileInputId = $( this ).attr( 'id' ),
|
31 |
$theReturn = $( '.' + $( this ).attr( 'id' ) );
|
33 |
$theReturn = $( '.' + fileInputId );
|
32 |
// Affichage du nom du fichier
|
34 |
// Affichage du nom du fichier
|
33 |
$theReturn.text( file.name );
|
35 |
$theReturn.text( file.name ).removeClass( 'hidden') ;
|
- |
|
36 |
|
- |
|
37 |
if( 5242880 < file.size ) {
|
- |
|
38 |
$theReturn.append(
|
- |
|
39 |
'<p class="message">'+
|
- |
|
40 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> '+
|
34 |
// Si le fichier est une image on l'affiche
|
41 |
'La taille du fichier ne doit pas dépasser 5Mo'+
|
- |
|
42 |
'</p>'
|
- |
|
43 |
)
|
- |
|
44 |
.addClass( 'invalid' );
|
- |
|
45 |
// lib : https://resources.tela-botanica.org/jquery/form/3.51/jquery.form.min.js
|
- |
|
46 |
$( this ).clearInputs();
|
- |
|
47 |
console.log(file);
|
- |
|
48 |
|
35 |
if( file.type.match( 'image/*' ) ) {
|
49 |
} else if( file.type.match( 'image/*' ) && 'especes' !== fileInputId ) {
|
- |
|
50 |
// Si le fichier est une image (et qu'on est pas sur "especes") on l'affiche
|
36 |
// Chemin temporaire de l'image et affichage
|
51 |
// Chemin temporaire de l'image et affichage
|
37 |
var tmppath = URL.createObjectURL( file );
|
52 |
var tmppath = URL.createObjectURL( file );
|
38 |
$theReturn.removeClass( 'hidden' ).append( '<img src="' + tmppath + '" width="50%">' );
|
53 |
$theReturn.append( '<img src="' + tmppath + '" width="50%">' ).removeClass( 'invalid' );;
|
- |
|
54 |
|
- |
|
55 |
} else if ( !( 'especes' === fileInputId && file.type.match( 'text/csv' ) ) ) {
|
- |
|
56 |
// on a pas un type image, ou on est sur une liste d'espèces mais on a pas un csv
|
- |
|
57 |
|
- |
|
58 |
if( 'especes' === fileInputId ) {// cas où on demandait un csv
|
- |
|
59 |
$theReturn.append(
|
- |
|
60 |
'<p class="message">'+
|
- |
|
61 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> '+
|
- |
|
62 |
'Le fichier doit être au format csv'+
|
- |
|
63 |
'</p>'
|
39 |
} else {
|
64 |
)
|
- |
|
65 |
.addClass( 'invalid' );
|
- |
|
66 |
} else { // cas où on demandait un format image
|
- |
|
67 |
$theReturn.append(
|
- |
|
68 |
'<p class="message">'+
|
- |
|
69 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> '+
|
40 |
$theReturn.removeClass( 'hidden' ).append( '<p>Le fichier doit être au format image (jpg, png, etc.)</p>' );
|
70 |
'Le fichier doit être au format image (jpg, png, etc.)'+
|
- |
|
71 |
'</p>'
|
- |
|
72 |
)
|
- |
|
73 |
.addClass( 'invalid' );
|
- |
|
74 |
}
|
41 |
// lib : https://resources.tela-botanica.org/jquery/form/3.51/jquery.form.min.js
|
75 |
// lib : https://resources.tela-botanica.org/jquery/form/3.51/jquery.form.min.js
|
42 |
$( this ).clearInputs();
|
76 |
$( this ).clearInputs();
|
43 |
console.log(file);
|
77 |
console.log(file);
|
- |
|
78 |
} else {// file "especes" csv ok
|
- |
|
79 |
$theReturn.append( ' <i class="fa fa-check-circle" aria-hidden="true" style="color:#B3C954;font-size:1.3rem"></i>' ).removeClass( 'invalid' );
|
44 |
}
|
80 |
}
|
45 |
}
|
81 |
}
|
46 |
});
|
82 |
});
|
47 |
// Annuler le téléchargement
|
83 |
// Annuler le téléchargement
|
48 |
$( '.remove-file' ).click( function() {
|
84 |
$( '.remove-file' ).click( function() {
|
Line 105... |
Line 141... |
105 |
$( '#new-fields' ).append(
|
141 |
$( '#new-fields' ).append(
|
106 |
'<fieldset data-id="' + fieldIndex + '" class="new-field">'+
|
142 |
'<fieldset data-id="' + fieldIndex + '" class="new-field">'+
|
107 |
'<h3>Nouveau champ :<br><strong class="field-title" data-id="' + fieldIndex + '"></strong></h3>'+
|
143 |
'<h3>Nouveau champ :<br><strong class="field-title" data-id="' + fieldIndex + '"></strong></h3>'+
|
108 |
// Nom du champ
|
144 |
// Nom du champ
|
109 |
'<label for="field-name" title="Donnez un titre à votre champ">Nom du champ *</label>'+
|
145 |
'<label for="field-name" title="Donnez un titre à votre champ">Nom du champ *</label>'+
|
110 |
'<input type="text" name="field-name" data-id="' + fieldIndex + '" class="field-name" placeholder="Titre de votre champ" title="Donnez un titre à votre champ" required>'+
|
146 |
'<input type="text" name="field-name" data-id="' + fieldIndex + '" class="field-name" placeholder="Titre de votre champ" title="Le titre du champ" required>'+
|
111 |
// Clé du champ
|
147 |
// Clé du champ
|
112 |
'<label for="field-key" title="Nom du champ dans la base de données">'+
|
148 |
'<label for="field-key" title="Nom du champ dans la base de données">'+
|
113 |
'Clé du champ *'+
|
149 |
'Clé du champ *'+
|
114 |
'</label>'+
|
150 |
'</label>'+
|
115 |
'<input type="text" name="field-key" data-id="' + fieldIndex + '" class="field-key" placeholder="Clé du champ" Pattern="^(?:[a-z]+(?:(?:[A-Z][a-z]+)+)?|[a-z]+(?:(?:-[a-z]+)+)?)$" title="Clé Unique en Camelcase ou minuscule séparés par tirets, pas d\'accents pas de caractères spéciaux." required>'+
|
151 |
'<input type="text" name="field-key" data-id="' + fieldIndex + '" class="field-key" placeholder="Clé du champ" pattern="^(?:[a-z]+(?:(?:[A-Z]+[a-z]+)+)?|[a-z]+(?:(?:-[a-z]+)+)?)$" title="Clé Unique en Camelcase ou minuscule séparés par tirets, pas d\'accents pas de caractères spéciaux." required>'+
|
116 |
'<p class="message">' +
|
152 |
'<p class="message">' +
|
117 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> '+
|
153 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> '+
|
118 |
'Une clé doit être unique<br>' +
|
154 |
'Une clé doit être unique<br>' +
|
119 |
'En "camelCase" (ecriture chameau)<br>'+
|
155 |
'En "camelCase" (ecriture chameau)<br>'+
|
120 |
'Ou en minuscule avec tirets ("-") si nécessaire<br>'+
|
156 |
'Ou en minuscule avec tirets ("-") si nécessaire<br>'+
|
Line 329... |
Line 365... |
329 |
$( '#new-fields' ).on( 'input' , '.list-value' , function() {
|
365 |
$( '#new-fields' ).on( 'input' , '.list-value' , function() {
|
330 |
var thisValue = $( this ).parent( '.new-value' );
|
366 |
var thisValue = $( this ).parent( '.new-value' );
|
331 |
if( '' !== $( this ).val() ) {
|
367 |
if( '' !== $( this ).val() ) {
|
332 |
$( '.is-defaut-value', thisValue ).removeAttr( 'disabled' );
|
368 |
$( '.is-defaut-value', thisValue ).removeAttr( 'disabled' );
|
333 |
} else {
|
369 |
} else {
|
334 |
$( '.is-defaut-value', thisValue ).attr( 'disabled', true ).removeAttr( 'checked' );
|
370 |
$( '.is-defaut-value', thisValue ).attr( 'disabled', true ).attr( 'checked' , false );
|
335 |
}
|
371 |
}
|
336 |
});
|
372 |
});
|
337 |
}
|
373 |
}
|
Line 338... |
Line 374... |
338 |
|
374 |
|
339 |
// Pour les éléments "select" et "radio" il ne peut y avoir qu'une valeur par défaut cochée
|
375 |
// Pour les éléments "select" et "radio" il ne peut y avoir qu'une valeur par défaut cochée
|
340 |
function onClickDefaultValueRemoveOthers( fieldIndex ) {
|
376 |
function onClickDefaultValueRemoveOthers( fieldIndex ) {
|
Line 341... |
Line 377... |
341 |
var selectedFieldElement = $( '.field-element[data-id="' + fieldIndex + '"]' ).val();
|
377 |
var selectedFieldElement = $( '.field-element[data-id="' + fieldIndex + '"]' ).val();
|
342 |
|
378 |
|
343 |
if( selectedFieldElement === 'select' || selectedFieldElement === 'radio' ) {
|
379 |
if( selectedFieldElement === 'select' || selectedFieldElement === 'radio' ) {
|
344 |
$( '.is-defaut-value[data-id="' + fieldIndex + '"]' ).click( function() {
|
380 |
$( '.is-defaut-value[data-id="' + fieldIndex + '"]' ).click( function() {
|
345 |
if( $( this ).attr( 'checked' ) ) {
|
381 |
if( $( this ).is( ':checked' ) ) {
|
346 |
// Décocher tous les autres
|
382 |
// Décocher tous les autres
|
347 |
$( '.is-defaut-value[data-id="' + fieldIndex + '"]:checked' ).not( $( this) ).removeAttr( 'checked' );
|
383 |
$( '.is-defaut-value[data-id="' + fieldIndex + '"]:checked' ).not( $( this) ).attr( 'checked' , false );
|
348 |
}
|
384 |
}
|
349 |
});
|
385 |
});
|
Line 564... |
Line 600... |
564 |
datasToSubmit[ resultArrayIndex ].mandatory = $( '.field-is_mandatory' , thisFieldset ).is( ':checked' );
|
600 |
datasToSubmit[ resultArrayIndex ].mandatory = $( '.field-is_mandatory' , thisFieldset ).is( ':checked' );
|
565 |
// Ajout de l'unité au tableau de resultats
|
601 |
// Ajout de l'unité au tableau de resultats
|
566 |
datasToSubmit[ resultArrayIndex ].unit = $( '.field-unit' , thisFieldset ).val() || null;
|
602 |
datasToSubmit[ resultArrayIndex ].unit = $( '.field-unit' , thisFieldset ).val() || null;
|
567 |
// Ajout du tooltip au tableau de resultats
|
603 |
// Ajout du tooltip au tableau de resultats
|
568 |
datasToSubmit[ resultArrayIndex ].description = $( '.field-description' , thisFieldset ).val() || null;
|
604 |
datasToSubmit[ resultArrayIndex ].description = $( '.field-description' , thisFieldset ).val() || null;
|
569 |
// Ajout du nom du document d'aide au tableau de resultats
|
- |
|
570 |
datasToSubmit[ resultArrayIndex ].help = $( '.file-return.help-doc-' + index ).text() || null;
|
- |
|
571 |
// Collecte les des données dépendantes de l'élément choisi
|
605 |
// Collecte les des données dépendantes de l'élément choisi
|
572 |
// sous forme d'un tableau de resultats
|
606 |
// sous forme d'un tableau de resultats
|
573 |
onSelectCollectDataValuesToSubmit( datasToSubmit[ resultArrayIndex ] , thisFieldset );
|
607 |
onSelectCollectDataValuesToSubmit( datasToSubmit[ resultArrayIndex ] , thisFieldset );
|
Line 574... |
Line 608... |
574 |
|
608 |
|
575 |
if( $.isEmptyObject( datasToSubmit[ resultArrayIndex ].fieldValues ) ){
|
609 |
if( $.isEmptyObject( datasToSubmit[ resultArrayIndex ].fieldValues ) ){
|
576 |
delete datasToSubmit[ resultArrayIndex ].fieldValues;
|
610 |
delete datasToSubmit[ resultArrayIndex ].fieldValues;
|
577 |
}
|
611 |
}
|
578 |
// Copie d'un champ de fichier d'aide dans le bloc d'envoi
|
612 |
// Copie d'un champ de fichier d'aide dans le bloc d'envoi
|
- |
|
613 |
if( 0 < $( '.field-help' , thisFieldset ).get(0).files.length ) {
|
- |
|
614 |
console.log( $( '.field-help' , thisFieldset ).get(0).files[0].type );
|
- |
|
615 |
// Présence d'un document d'aide
|
579 |
if( '' !== $( '.field-help' , thisFieldset ).val() ) {
|
616 |
datasToSubmit[ resultArrayIndex ].help = $( '.field-help' , thisFieldset ).get(0).files[0].type;
|
580 |
$( '.field-help' , thisFieldset ).clone()
|
617 |
$( '.field-help' , thisFieldset ).clone()
|
581 |
.attr( 'name' , 'help-' + datasToSubmit[ resultArrayIndex ].key )// l'attribut name prend la valeur de la clé
|
618 |
.attr( 'name' , 'help-' + datasToSubmit[ resultArrayIndex ].key )// l'attribut name prend la valeur de la clé
|
- |
|
619 |
.appendTo( '#help-doc-submit' );
|
- |
|
620 |
} else {
|
582 |
.appendTo( '#help-doc-submit' );
|
621 |
datasToSubmit[ resultArrayIndex ].help = null;
|
583 |
}
|
622 |
}
|
584 |
resultArrayIndex++;
|
623 |
resultArrayIndex++;
|
585 |
}
|
624 |
}
|
- |
|
625 |
}
|
586 |
}
|
626 |
|
- |
|
627 |
var resultsArrayJson = JSON.stringify( datasToSubmit , replacer );
|
- |
|
628 |
|
- |
|
629 |
// JSON.strigify : Gestion des apostrophes dans les valeurs :
|
- |
|
630 |
function replacer( key , value ) {
|
- |
|
631 |
if ( 'fieldValues' === key && 'object' === typeof value ) {
|
- |
|
632 |
for ( var i in value ) {
|
- |
|
633 |
if ( typeof value[i] === 'string' ) {
|
- |
|
634 |
value[i] = value[i].replace( /\u0027/g, "''" );
|
- |
|
635 |
}
|
- |
|
636 |
}
|
- |
|
637 |
} else if ( typeof value === 'string' ) {
|
- |
|
638 |
value = value.replace( /\u0027/g, "''" );
|
- |
|
639 |
}
|
- |
|
640 |
return value;
|
- |
|
641 |
}
|
587 |
var resultsArrayJson = JSON.stringify( datasToSubmit );
|
642 |
|
- |
|
643 |
console.log( resultsArrayJson );
|
588 |
console.log(resultsArrayJson);
|
644 |
|
589 |
// Désactivation de tous les champs et boutons (nouveaux champs)
|
645 |
// Désactivation de tous les champs et boutons (nouveaux champs)
|
590 |
$( '#new-fields, #new-fields .button , #add-fields , #preview-field' ).addClass( 'disabled' );
|
646 |
$( '#new-fields, #new-fields .button , #add-fields , #preview-field' ).addClass( 'disabled' );
|
591 |
$( '#validate-new-fields' ).addClass( 'validated' );
|
647 |
$( '#validate-new-fields' ).addClass( 'validated' );
|
592 |
$( '.validate-new-fields' ).text( 'Champs validés' );
|
648 |
$( '.validate-new-fields' ).text( 'Champs validés' );
|
593 |
// Mise à disposition des données pour le bouron submit
|
649 |
// Mise à disposition des données pour le bouron submit
|
- |
|
650 |
$( '#submit-button' ).before(
|
594 |
$( '#submit-button' ).before(
|
651 |
//la value est passée avec des apostrophes pour que les guillemets de la string json passent bien en string de l'attribut
|
595 |
'<input type="hidden" name="champs-supp" id="champs-supp" value="' + resultsArrayJson + '">'
|
652 |
'<input type="hidden" name="champs-supp" id="champs-supp" value=\'' + resultsArrayJson + '\'>'
|
596 |
);
|
653 |
);
|
Line 597... |
Line 654... |
597 |
}
|
654 |
}
|
598 |
|
655 |
|
Line 606... |
Line 663... |
606 |
case 'radio':
|
663 |
case 'radio':
|
607 |
datasToSubmitObject.fieldValues.listValue = [];
|
664 |
datasToSubmitObject.fieldValues.listValue = [];
|
608 |
// Ajout des valeurs de liste
|
665 |
// Ajout des valeurs de liste
|
609 |
onChangeStoreListValueLabel( datasToSubmitObject , thisFieldset );
|
666 |
onChangeStoreListValueLabel( datasToSubmitObject , thisFieldset );
|
610 |
// S'il y a une valeur 'autre' on l'indique à la fin de la liste
|
667 |
// S'il y a une valeur 'autre' on l'indique à la fin de la liste
|
611 |
if( $( '.option-other-value' , thisFieldset ).attr( 'checked' ) && -1 === datasToSubmitObject.fieldValues.listValue.indexOf( 'other' ) ) {
|
668 |
if( $( '.option-other-value' , thisFieldset ).is( ':checked' ) && -1 === datasToSubmitObject.fieldValues.listValue.indexOf( 'other' ) ) {
|
612 |
datasToSubmitObject.fieldValues.listValue.push( 'other' );
|
669 |
datasToSubmitObject.fieldValues.listValue.push( 'other' );
|
613 |
}
|
670 |
}
|
614 |
break;
|
671 |
break;
|
Line 615... |
Line 672... |
615 |
|
672 |
|
Line 651... |
Line 708... |
651 |
$( '.list-value' , thisFieldset ).each( function() {
|
708 |
$( '.list-value' , thisFieldset ).each( function() {
|
652 |
var selectedFieldElement = $( '.field-element' , thisFieldset ).val();
|
709 |
var selectedFieldElement = $( '.field-element' , thisFieldset ).val();
|
Line 653... |
Line 710... |
653 |
|
710 |
|
654 |
if( $( this ).val() ){
|
711 |
if( $( this ).val() ){
|
655 |
// Is-default-value non cochée
|
712 |
// Is-default-value non cochée
|
656 |
if( !$( '.is-defaut-value[data-list-value-id="' + $( this ).data( 'list-value-id' ) + '"]' , thisFieldset ).attr( 'checked' ) ) {
|
713 |
if( !$( '.is-defaut-value[data-list-value-id="' + $( this ).data( 'list-value-id' ) + '"]' , thisFieldset ).is( ':checked' ) ) {
|
657 |
datasToSubmitObject.fieldValues.listValue.push( $( this ).val() );
|
714 |
datasToSubmitObject.fieldValues.listValue.push( $( this ).val() );
|
658 |
// Is-default-value cochée pour select/radio
|
715 |
// Is-default-value cochée pour select/radio
|
659 |
} else if( 'select' === selectedFieldElement || 'radio' === selectedFieldElement ) {
|
716 |
} else if( 'select' === selectedFieldElement || 'radio' === selectedFieldElement ) {
|
660 |
// Une seule valeur par defaut, devient la première valeur du tableau + '#'
|
717 |
// Une seule valeur par defaut, devient la première valeur du tableau + '#'
|
Line 754... |
Line 811... |
754 |
var fieldHtml = '',//variable contenant tout le html à afficher
|
811 |
var fieldHtml = '',//variable contenant tout le html à afficher
|
755 |
commonFieldsHtml = {},//Éléments simples ou chaînes communes aux "listes"
|
812 |
commonFieldsHtml = {},//Éléments simples ou chaînes communes aux "listes"
|
756 |
listFieldsHtml = {},//chaînes & html pour les listes mais non spécifiques
|
813 |
listFieldsHtml = {},//chaînes & html pour les listes mais non spécifiques
|
757 |
listFieldsHtml = {},//chaînes & html spécifiques aux listes
|
814 |
listFieldsHtml = {},//chaînes & html spécifiques aux listes
|
758 |
count = fieldOptions.length;//nombre d'options, pour les boucles for
|
815 |
count = fieldOptions.length;//nombre d'options, pour les boucles for
|
- |
|
816 |
fieldLabel = fieldLabel.replace( /(')/gm, '''' ).replace( /(")/gm, '""' );
|
- |
|
817 |
fieldTooltip = fieldTooltip.replace( /(')/gm, '''' ).replace( /(")/gm, '""' );
|
- |
|
818 |
fieldPlaceholder = fieldPlaceholder.replace( /(')/gm, '''' ).replace( /(")/gm, '""' );
|
- |
|
819 |
|
759 |
//valeurs initiales des chaînes de caractères
|
820 |
//valeurs initiales des chaînes de caractères
|
760 |
//Éléments simples ou chaînes communes aux "listes"
|
821 |
//Éléments simples ou chaînes communes aux "listes"
|
761 |
commonFieldsHtml = {
|
822 |
commonFieldsHtml = {
|
762 |
dataIdAttr : ' data-id="' + index + '"',
|
823 |
dataIdAttr : ' data-id="' + index + '"',
|
763 |
helpButton : '',//bouton aide
|
824 |
helpButton : '',//bouton aide
|
Line 876... |
Line 937... |
876 |
// value-id
|
937 |
// value-id
|
877 |
listFieldsHtml.optionIdAttr +
|
938 |
listFieldsHtml.optionIdAttr +
|
878 |
// Name
|
939 |
// Name
|
879 |
commonFieldsHtml.fieldInput.nameAttr +
|
940 |
commonFieldsHtml.fieldInput.nameAttr +
|
880 |
// Value
|
941 |
// Value
|
881 |
' value="' + fieldOption.optionValue + '"' +
|
942 |
' value="' + fieldOption.optionValue.replace( /(')/gm, '''' ).replace( /(")/gm, '""' ) + '"' +
|
882 |
// Checked
|
943 |
// Checked
|
883 |
listFieldsHtml.defaultAttr +
|
944 |
listFieldsHtml.defaultAttr +
|
884 |
// Class="nom du champ"
|
945 |
// Class="nom du champ"
|
885 |
commonFieldsHtml.fieldInput.classAttr +
|
946 |
commonFieldsHtml.fieldInput.classAttr +
|
886 |
'>' +
|
947 |
'>' +
|
887 |
// Label de l'option
|
948 |
// Label de l'option
|
888 |
fieldOption.optionText +
|
949 |
fieldOption.optionText.replace( /(')/gm, '''' ).replace( /(")/gm, '""' ) +
|
889 |
'</label>';
|
950 |
'</label>';
|
890 |
}
|
951 |
}
|
891 |
// Si valeur "autre" est cochée
|
952 |
// Si valeur "autre" est cochée
|
892 |
if( fieldOtherValue ) {
|
953 |
if( fieldOtherValue ) {
|
893 |
fieldHtml +=
|
954 |
fieldHtml +=
|
Line 944... |
Line 1005... |
944 |
for( let i = 0; i < count; i++ ) {
|
1005 |
for( let i = 0; i < count; i++ ) {
|
945 |
let fieldOption = fieldOptions[i];
|
1006 |
let fieldOption = fieldOptions[i];
|
946 |
// Type="checkbox"
|
1007 |
// Type="checkbox"
|
947 |
commonFieldsHtml.fieldInput.typeAttr = ' type="checkbox"';
|
1008 |
commonFieldsHtml.fieldInput.typeAttr = ' type="checkbox"';
|
948 |
// Id
|
1009 |
// Id
|
949 |
listFieldsHtml.inputIdAttr = ' id="' + fieldOption.optionValue.toLowerCase() + '"';
|
1010 |
listFieldsHtml.inputIdAttr = ' id="' + fieldOption.optionValue.replace( /(')/gm, '''' ).replace( /(")/gm, '""' ).toLowerCase() + '"';
|
950 |
// For
|
1011 |
// For
|
951 |
listFieldsHtml.forAttr = ' for="' + fieldOption.optionValue.toLowerCase() + '"';
|
1012 |
listFieldsHtml.forAttr = ' for="' + fieldOption.optionValue.replace( /(')/gm, '''' ).replace( /(")/gm, '""' ).toLowerCase() + '"';
|
952 |
// Default
|
1013 |
// Default
|
953 |
listFieldsHtml.defaultAttr = '';//réinitialisation
|
1014 |
listFieldsHtml.defaultAttr = '';//réinitialisation
|
954 |
if( fieldOption.isDefault ) {
|
1015 |
if( fieldOption.isDefault ) {
|
955 |
listFieldsHtml.defaultAttr = ' checked';//affectation
|
1016 |
listFieldsHtml.defaultAttr = ' checked';//affectation
|
956 |
}
|
1017 |
}
|
Line 972... |
Line 1033... |
972 |
// value-id
|
1033 |
// value-id
|
973 |
listFieldsHtml.optionIdAttr +
|
1034 |
listFieldsHtml.optionIdAttr +
|
974 |
// Name
|
1035 |
// Name
|
975 |
commonFieldsHtml.fieldInput.nameAttr +
|
1036 |
commonFieldsHtml.fieldInput.nameAttr +
|
976 |
// Value
|
1037 |
// Value
|
977 |
' value="' + fieldOption.optionValue + '"' +
|
1038 |
' value="' + fieldOption.optionValue.replace( /(')/gm, '''' ).replace( /(")/gm, '""' ) + '"' +
|
978 |
// Checked
|
1039 |
// Checked
|
979 |
listFieldsHtml.defaultAttr +
|
1040 |
listFieldsHtml.defaultAttr +
|
980 |
// Class="nom du champ"
|
1041 |
// Class="nom du champ"
|
981 |
commonFieldsHtml.fieldInput.classAttr +
|
1042 |
commonFieldsHtml.fieldInput.classAttr +
|
982 |
// DataId
|
1043 |
// DataId
|
983 |
commonFieldsHtml.dataIdAttr +
|
1044 |
commonFieldsHtml.dataIdAttr +
|
984 |
'>' +
|
1045 |
'>' +
|
985 |
// Label de l'option
|
1046 |
// Label de l'option
|
986 |
fieldOption.optionText +
|
1047 |
fieldOption.optionText.replace( /(')/gm, '''' ).replace( /(")/gm, '""' ) +
|
987 |
'</label>';
|
1048 |
'</label>';
|
988 |
}
|
1049 |
}
|
989 |
// Si valeur "autre" est cochée
|
1050 |
// Si valeur "autre" est cochée
|
990 |
if( fieldOtherValue ) {
|
1051 |
if( fieldOtherValue ) {
|
991 |
fieldHtml +=
|
1052 |
fieldHtml +=
|
Line 1052... |
Line 1113... |
1052 |
}
|
1113 |
}
|
Line 1053... |
Line 1114... |
1053 |
|
1114 |
|
1054 |
fieldHtml +=
|
1115 |
fieldHtml +=
|
1055 |
'<option' +
|
1116 |
'<option' +
|
1056 |
// Value
|
1117 |
// Value
|
1057 |
' value="' + fieldOption.optionValue + '"' +
|
1118 |
' value="' + fieldOption.optionValue.replace( /(')/gm, '''' ).replace( /(")/gm, '""' ) + '"' +
|
1058 |
// Value-id
|
1119 |
// Value-id
|
1059 |
listFieldsHtml.optionIdAttr +
|
1120 |
listFieldsHtml.optionIdAttr +
|
1060 |
// Selected
|
1121 |
// Selected
|
1061 |
listFieldsHtml.defaultAttr +
|
1122 |
listFieldsHtml.defaultAttr +
|
1062 |
'>' +
|
1123 |
'>' +
|
1063 |
// Option
|
1124 |
// Option
|
1064 |
fieldOption.optionText +
|
1125 |
fieldOption.optionText.replace( /(')/gm, '''' ).replace( /(")/gm, '""' ) +
|
1065 |
'</option>';
|
1126 |
'</option>';
|
1066 |
}
|
1127 |
}
|
1067 |
// Si valeur "autre" est cochée
|
1128 |
// Si valeur "autre" est cochée
|
1068 |
if( fieldOtherValue ) {
|
1129 |
if( fieldOtherValue ) {
|
Line 1279... |
Line 1340... |
1279 |
commonFieldsHtml.dataIdAttr +
|
1340 |
commonFieldsHtml.dataIdAttr +
|
1280 |
// Class
|
1341 |
// Class
|
1281 |
commonFieldsHtml.fieldInput.classAttr +
|
1342 |
commonFieldsHtml.fieldInput.classAttr +
|
1282 |
// Info-bulle
|
1343 |
// Info-bulle
|
1283 |
commonFieldsHtml.titleAttr +
|
1344 |
commonFieldsHtml.titleAttr +
|
1284 |
// Info-bulle
|
1345 |
// Placeholder
|
1285 |
commonFieldsHtml.fieldInput.placeholderAttr +
|
1346 |
commonFieldsHtml.fieldInput.placeholderAttr +
|
1286 |
// Required
|
1347 |
// Required
|
1287 |
commonFieldsHtml.fieldInput.mandatoryAttr +
|
1348 |
commonFieldsHtml.fieldInput.mandatoryAttr +
|
1288 |
// Autres attributs
|
1349 |
// Autres attributs
|
1289 |
commonFieldsHtml.fieldInput.otherAttr +
|
1350 |
commonFieldsHtml.fieldInput.otherAttr +
|