javascript - Simple form validation in Sencha Touch -
I have seen many instances of form validation in CentCach, but for all what I want to do, all are very complex . I do not need a model or store, because server-side will be handled in the area of the question. Is there any easy way to check whether the field populations have a population before submitting it or not?
I have tried
if (myForm.getComponent ('fieldet') .getComponent ('myField'). Length == 0) } But whenever the field is empty the situation is not complete. There are no JS errors in the console.
You must first get the value of the field. You are probably always failing in the condition, because .length is being evaluated against that component and its text is not, so if the component is defined, its length is always greater than zero Will be. Try it:
If (myForm.getComponent ('field'). GetComponent ('myField'). GetValue (.) Length == 0) {// / Do something}
Comments
Post a Comment