Hi,
exist a function or similar that allow me to check all fields required are written?
My fields are different from each other (combobox, validatebox,...), but almost all, have required=true as inside option.
If the check is ok ,proceed to write, otherwise expose a allert message when i click a linkbutton (to save information) (I Want to check at the end).
I thought about this solution:
- Scroll through all the elements by checking if required ! = Undefined
- Check if the field is written.(if != Undefined)
var rows = $('#details').propertygrid('getChanges');
for(var i=0; i<rows.length; i++){
if(rows[i].hasOwnProperty('editor')) {
if(rows[i].editor.options.hasOwnProperty('required')) {
if(rows[i].editor.options.required && (rows[i].value==""))
console.log("Required, without value! ALLERT!!!!");
else
console.log("Requested and completed");
} else
console.log("I do not care");
} else
console.log("I do not care");
}
The values I get with
$('#details').propertygrid ('getChanges') are:
0: {…}
editor: {…}
options: {…}
missingMessage: "No Field!"
required: true validType: Object { length: […] }
__proto__: Object { … }
type: "validatebox"
__proto__: Object { … }
group: "Dettagli"
index: 0
name: "Name"
value: ""
__proto__: Object { … }
.....
5: {…}
editor: {…}
options: {…}
validType: Object { length: […] }
__proto__: Object { … }
type: "validatebox"
__proto__: Object { … }
group: "Dettagli"
index: 5
name: "Tag"
value: ""
....
Is there another way?
Thanks!