Opened 4 years ago

Closed 3 years ago

#18800 closed defect (invalid)

Метод validate.check() всеп поля помечает как Invalid

Reported by: victorynox Owned by: dylan
Priority: undecided Milestone: 1.13
Component: Dojox Version: 1.10.4
Keywords: Cc:
Blocked By: Blocking:

Description

Метод validate.check() все поля помечает как Invalid. Так как во время проверки корректности поля ожидается объект constraintResponse с полями isValid(bool), message(string), а методы проверки (validate.isText и подобные) возвращают true или false, в итоге проверяется constraintResponse.isValid который в свою очередь на самом деле является не объектом, а bool переменной

var constraintResponse;
			// case 1: constraint value is validation function
			if(lang.isFunction(profile.constraints[name])){
				constraintResponse = profile.constraints[name](elem.value);
			}else if(lang.isFunction(lang.getObject(name, false, profile.constraints))){
				// case 2: constraint value is validation function name as string
				constraintResponse = lang.getObject(name, false, profile.constraints)(elem.value);
			}else if(lang.isArray(profile.constraints[name])){

				// handle nested arrays for multiple constraints
				if(lang.isArray(profile.constraints[name][0])){
					for(var i=0; i<profile.constraints[name].length; i++){
						constraintResponse = validate.evaluateConstraint(profile, profile.constraints[name][i], name, elem);
						if(!constraintResponse.isValid){ break; }
					}
				}else{
					// case 3: constraint value is array, first elem is function,
					// tail is parameters
					if(lang.isFunction(lang.getObject(name, false, profile.constraints))){
							constraintResponse = validate.evaluateConstraint(profile, profile.constraints[profile.constraints[name]], name, elem);
					}else{
						constraintResponse = validate.evaluateConstraint(profile, profile.constraints[name], name, elem);
					}
				}
			}

			// if constraintResponse is false (backwards compatibility with last version) or if property isValid is false, return the invalid field name and/or the constraintResponse message
			if(!constraintResponse){
				invalid[invalid.length] = elem.name;
			}else if(!constraintResponse.isValid){
				invalid[invalid.length] = { field : elem.name, message : constraintResponse.message

Change History (3)

comment:1 Changed 3 years ago by dylan

Status: newpending

Apologies, but we'll need the ticket report in English to be able to understand the issue at hand. Thanks for your consideration.

comment:2 Changed 3 years ago by dylan

Milestone: tbd1.13

comment:3 Changed 3 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.