Tag Archives: example

Begin a validation library – form validation

In part to help other developers, and in part so that I don’t forget, I’ll post the beginnings of a Titanium Studio form validation library. This is what I created today.

//TEST FIELDS FOR NUMBER CHARACTERS
var hasNumbers = /[0-9]+(?:\.[0-9]*)?/;

var testFields = [ADD FIELD NAMES LIST HERE];

var hasNumberAlert = Titanium.UI.createAlertDialog({
title : ‘Attention:’,
message : ‘Fields cannot contain numbers.’
});

for(var i = 0, j = testFields.length; i < j; i++) {
if(hasNumbers.test(testFields[i])) {
hasNumberAlert.show();
noNumbers = false;
break;
}
}
// VALIDATE INPUT
if(noNumbers === true) {
Titanium.UI.window.open();
}
});

As always, feel free to post comments on ways to improve this code or your questions here.

Happy coding.

Leave a comment

Filed under iOS SDK, Javascript, Software, Titanium Studio

Zend_forms in your models vis-a-vis MVC

Using Zend_Form in Your Models – phly, boy, phly.

If you use Zend Framework for web development, get to know this guy. At my knowledge level, this discussion is over my head, but I’m blogging it because I know I’ll be able to use it later.

Hope you can, too.

Leave a comment

Filed under All things Zend, Development