Hi,
We developed a mobile application using DevExtreme "knockout-3.1.0.js", "knockout.validation.js" and " jquery-2.1.1.min.js" its working fine, after updating "knockout-3.2.0.js" and " jquery-2.1.3.min.js", its not working.
Here is working code with old version:
JavaScriptvar self = this;
result += "<div class='dx-field'>";
result += " <div class='dx-field-label'>" + data[i].fieldName + ": </div>";
//result += " <div class='dx-field-value' id='Custom" + i + "' style='width:100px;margin-right:100px;'></div>";
result += " <div class='dx-field-value' id='Custom" + i + "'></div>";
result += "</div>";
$("#customFieldArea").append(result);
if (eval(data[i].requiredField) == true) {
var Custom0 = ko.observable().extend({
required: 'Please enter value.'
});
self.Custom0 = Custom0;
$("#Custom" + i).dxTextBox({
placeholder: "Enter Text",
value: Custom0,
});
} else {
$("#Custom" + i).dxTextBox({
placeholder: "Enter Text",
});
}
var validationModel = ko.validatedObservable(self);
if (validationModel.isValid()) {
// create event
} else {
// Alert
}
The above code is not working any more in new upgrade.
We are trying implement using your example validtaions. Its not working. Can you please give working examples.
JavaScript$("#Custom" + i).dxTextBox({
placeholder: "Enter Text",
value: ko.observable(""),
isValid: eventOptions.login1.dxValidator.isValid,
validationError: eventOptions.login1.dxValidator.validationError,
});
//}).dxValidator({ name: 'Name', validationRules: [{ type: 'required' }]});
} else {
$("#Custom" + i).dxTextBox({
placeholder: "Enter Text",
});
}
Thank you,
Subash
Hi Subash,
I am afraid that the provided information is not sufficient to determine the cause of the problem. Your code is not complete and uses a third-party library. Would you please reproduce the issue in a simple project and send it to us for research? If it is not possible, please let us know. We will find another way to help you.
Hi Uriah,
Thank for your quick response.
Its not easy to create a projects, we are creating dynamic controls.
Make it simple, can you please create a dynamic dxTextBox control on fly and validate with required field validation. That what I am trying to do.
Thank you,
Subash