3
3
// TEXT //
4
4
//======================================
5
5
6
- function createField ( keyTextField , title , placeHolder , error , mandatory , cellColor , keyboard , validator , minLength , maxLength , titleColor , errorColor , sizeTitle , sizeError , align , font , imageMandatory ) {
6
+ function createField ( keyTextField , title , placeHolder , error , mandatory , cellColor , keyboard , validator , minLength , maxLength , titleColor , errorColor , sizeTitle , sizeError , align , font , imageMandatory , customValidator ) {
7
7
var valueCheck = ""
8
8
if ( mandatory ) {
9
9
valueCheck = "checked"
@@ -17,13 +17,18 @@ function createField(keyTextField,title,placeHolder,error,mandatory,cellColor,ke
17
17
18
18
var styles = htmlFontSize + htmlBackgroundColor + htmlAlingFont + htmlImages ;
19
19
20
- var html = '<div class="cellConstructor"id="fieldNumber' + indexField + '"><div class="row"><div class="col-md-10"><div class="keyTextField"><p>key*:</p><input type="text"name="keyTextField"id="keyTextField"disabled value="' + keyTextField + '"></div><div class="containerTextFieldTop"><div class="titleTextField"><p>Titulo*:</p><input type="text"name="titleTextField"id="titleTextField"disabled value="' + title + '"></div><div class="keyboardResult">Keyboard:' + keyboard + '</div></div><div class="containerTextFieldCenter"><div class="inputTextField"><p>PlaceHolder:</p><input type="text"name="palceHolderTextField"id="palceHolderTextField"disabled value="' + placeHolder + '"></div><div class="mandatoryTextField"><input type="checkbox"name="mandatory"value="mandatory"id="mandatory"' + valueCheck + ' disabled readonly><p>Es obligatorio?</p></div><div class="validatorResult">Validator:' + validator + '</div></div><div class="errorTextField"><p class="textErrorP">Texto error:</p><input type="text"name="errorTextField"id="errorTextField"disabled value="' + error + '"><p>minLength:</p><input class="inputWidth"type="text"name="minLength"id="minLength"disabled readonly value="' + minLength + '"><p>maxLength:</p><input class="inputWidth"type="text"name="maxLength"id="maxLength"disabled readonly value="' + maxLength + '"></div><div class="styleField"><h4>Estilos de celda:</h4>' + styles + '</div><div class="spaceSeparate"></div></div><div class="col-md-2 buttonRemove buttonRemoveText"onclick="removeField(' + indexField + ')"><p>-</p></div></div></div>' ;
20
+ $htmlCustomValidator = ""
21
+ if ( validator == "customValidator" ) {
22
+ $htmlCustomValidator = '<input type="text"name="customValidatorTextField"id="customValidatorTextField"disabled value="' + customValidator + '">'
23
+ }
24
+
25
+ var html = '<div class="cellConstructor"id="fieldNumber' + indexField + '"><div class="row"><div class="col-md-10"><div class="keyTextField"><p>key*:</p><input type="text"name="keyTextField"id="keyTextField"disabled value="' + keyTextField + '"></div><div class="containerTextFieldTop"><div class="titleTextField"><p>Titulo*:</p><input type="text"name="titleTextField"id="titleTextField"disabled value="' + title + '"></div><div class="keyboardResult">Keyboard:' + keyboard + '</div></div><div class="containerTextFieldCenter"><div class="inputTextField"><p>PlaceHolder:</p><input type="text"name="palceHolderTextField"id="palceHolderTextField"disabled value="' + placeHolder + '"></div><div class="mandatoryTextField"><input type="checkbox"name="mandatory"value="mandatory"id="mandatory"' + valueCheck + ' disabled readonly><p>Es obligatorio?</p></div><div class="validatorResult">Validator:' + validator + '</div> ' + $htmlCustomValidator + ' </div><div class="errorTextField"><p class="textErrorP">Texto error:</p><input type="text"name="errorTextField"id="errorTextField"disabled value="' + error + '"><p>minLength:</p><input class="inputWidth"type="text"name="minLength"id="minLength"disabled readonly value="' + minLength + '"><p>maxLength:</p><input class="inputWidth"type="text"name="maxLength"id="maxLength"disabled readonly value="' + maxLength + '"></div><div class="styleField"><h4>Estilos de celda:</h4>' + styles + '</div><div class="spaceSeparate"></div></div><div class="col-md-2 buttonRemove buttonRemoveText"onclick="removeField(' + indexField + ')"><p>-</p></div></div></div>' ;
21
26
22
27
$ ( "#containerListItemsCreated" ) . append ( html ) ;
23
28
resetTypeField ( ) ;
24
29
}
25
30
26
- function saveField ( keyTextField , type , title , placeHolder , textError , mandatory , cellColor , keyboard , validator , minLength , maxLength , titleColor , errorColor , sizeTitle , sizeError , align , font , imageMandatory ) {
31
+ function saveField ( keyTextField , type , title , placeHolder , textError , mandatory , cellColor , keyboard , validator , minLength , maxLength , titleColor , errorColor , sizeTitle , sizeError , align , font , imageMandatory , customValidator ) {
27
32
//-- Mandatory Fiedls --
28
33
var itemSave = {
29
34
"tag" :indexField ,
@@ -52,8 +57,12 @@ function saveField(keyTextField,type,title,placeHolder,textError,mandatory,cellC
52
57
}
53
58
if ( validator != "None" ) {
54
59
itemSave [ "validator" ] = validator
60
+ if ( validator == "customValidator" ) {
61
+ itemSave [ "customValidator" ] = customValidator
62
+ }
55
63
}
56
64
65
+
57
66
//-- OPTIONAL FIELDS --
58
67
var styles = getStylesJson ( cellColor , titleColor , errorColor , sizeTitle , sizeError , "" , "" , "" , align , font , imageMandatory , "" , "" ) ;
59
68
0 commit comments