 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
MaltBlue.com: Zend Form Mastery with Zend Config - Part 4 Configuring Zend Validators
by Chris Cornutt June 05, 2012 @ 11:25:45
On the MaltBlue blog Matt has posted the latest part of the "Zend_Form with Zend_Config" series, part four looking at using and configuring some form validators.
Welcome to the fourth and final part in the Zend Form Mastery with Zend Config series. Previously we looked at the basic form options, element and form wide prefixes, filters and element options. In this installment, we're going to look at configuring Zend Validators via our XML config. [...] To go in to all of them will take more time than is allowed in the confines of this article. So we're going to work through 5 of the more interesting and likely used ones.
He covers the validation for: email addresses, postal codes, seeing if a record exists in the database, IBAN validation and checking to see if a value is in an array. He gives XML examples for each of these validation methods including the definitions of options and error/feedback messages.
voice your opinion now!
zendform zendconfig configure validator tutorial xml
Henrik Bjørnskov's Blog: Symfony2 Using the validator symfony1 style
by Chris Cornutt February 03, 2012 @ 11:15:01
In this quick new post to his blog Henrik Bjørnskov shows how to use the validators in Symfony2 in a more traditional Symfony 1 style for a form.
Two of the more complicated components in Symfony2 is the Form and Validator component. The Validator is created in such a way it "always" need an Domain Object with Constraints associated through metadata. This is explained in detail here. But there is another way. A way that resemble's the symfony1 forms. Where you could specify the validations directly in your form class.
Code is included in the post to show how to load in a few of the validators (like NotBlank, Email and Choice) and how to use them in the settings defined in the "getDefaultOptions" method.
voice your opinion now!
symfony2 validator form symfony1 options
DevShed: Building Concrete Validators
by Chris Cornutt December 22, 2011 @ 11:24:25
On DevShed.com today there's the first part of a two-part series showing how to build self-contained validator objects that can be used to test the format of user input for validity.
In this two-part tutorial, I show why the use of static helper classes can be detrimental to building robust and scalable object-oriented applications in PHP (though you should take into account that the concept is language agnostic). I also implement a set of instantiable, fine-grained validators, which can be easily tested in isolation, injected into the internals of other objects, and so forth.
Their set of "concrete validators" are all based off of a validator interface/abstract class and check things like email formatting, floats, integers and URLs. Also included are a few examples of using the validators in a sample script.
voice your opinion now!
validator tutorial test data interface abstract class
Simas Toleikis's Blog: Idea for a PHP Validator
by Chris Cornutt October 08, 2010 @ 13:48:26
Simas Toleikis has posted an interesting idea for a validator that would look at the incoming source of an application/script and determine what the requirements for it might be.
How about creating a PHP code validator? Got this idea by looking at tokenizer and reflection extensions. I doubt I will find the time to work on this myself but then someone else might be interested to pick it up. From user's point of view there will be a form made of a large textarea box and a single file upload input. One could paste code snippet on that textarea or upload a ZIP'ed source code archive (or a single .php file) for validation.
His proposed result would show a list of "Required Extensions", PHP versions, E_STRICT compatibility and possibly total lines of code in the project. He points out a few issues that might pop up in writing such a tool such as the requirement for it to be able to use the tokenizer extension itself (a sort of catch-22 since it's not always installed).
voice your opinion now!
validator idea requirements application reflection tokenizer
Jani Hartikainen's Blog: Validating Zend_Forms using model objects
by Chris Cornutt May 08, 2009 @ 10:27:30
Jani Hartikainen has posted a three-step process to his blog about handling the information submitted into a Zend_Form instance with a model.
Zend_Forms, models, validation and how they all work together is a tricky topic. There are many opinions and many ways to do it. This time I'll show you what I think could be the answer to validating forms without having to duplicate validation code both in a model class and in your form.
He creates a simple model interface (with get, set, isValid and getMessages methods) and a validator extended from Zend_Validate_Abstract to pass the information back into the model through an isValid method call. The validator is then added to each element you want to use it on in the addElement call on the Zend_Form object.
voice your opinion now!
validate zendform model object validator isvalid addelement zendframework
Symfony Blog: Call the expert How to implement a conditional validator?
by Chris Cornutt September 05, 2008 @ 12:06:18
On the symfony blog today, there's a new post that looks at creating a conditional validator in the context of a classic login form for the framework.
Jon works on a symfony 1.1 project with a classic login form. The form is composed of two fields: a username and a password. The validation rules are quite straightforward: he wants each field to be required and he wants to check the correctness of the password.
They show how to set up a normal login widget and how to apply a sfValidatorCallback in the configure() method to check the values in the form. This method checks the username and password values and tosses an error with sfValidatorError if a problem is found.
voice your opinion now!
conditional validator tutorial symfony framework
Thomas Weidner's Blog: Zend_File_Transfer examples or using validators to increase security
by Chris Cornutt July 24, 2008 @ 13:41:47
Thomas Weidner has posted about a method he's come up with to help protect you and your site when uploading files through the Zend_File_Transfer component from the Zend Framework.
The new Zend_File_Transfer component is growing day for day.
As incredible new feature this component allows to use file validators. These are necessary to increase security and allow to define rules for file uploads (and also downloads in future).
He illustrates with a simple Zend_File_Transfer object that uses an addValidators call to limit the size of the upload to 50 KB. Other validation rules include count (the number of files to expect), extension, filessize and imagesize. Using these he makes a "more secure" upload object setting the size to 205KB, to expect five files that are all under 1MB and are of the types gif/jpg/png.
voice your opinion now!
zendfiletransfer component zendframework secure validator
Scott Johnson's Blog: Your Simple PHP Code Snippet for Monday
by Chris Cornutt May 09, 2006 @ 06:03:23
Trying to find the HTML errors in a complex layout on a page can get very frustrating (especially when it repeats elements generated by backend scripts). Scott Johnson had one such instance, so he wrote a little script to help with it.
I wasn't planning on blogging much today (or, honestly, this week) since we're making good progress on Ookles but our designer just had to deal with the situation where one of our developers clobbered our page footer w/ a comment gone astray and she wasted quite a bit of time analyzing the problem. Which, naturally, turned out to be nothing more than an unbalanced set of div tags.
And since that's more often than not the problem these days with CSS bugs - at least for us - I whipped up a drop dead dumb div tag counter which seems to work but I suspect isn't perfect since its about as naive as you can get.
He has the source of the script included in the post as well as two examples of using it with msn.com and news.com. Other suggestions of tools to help with these problems are listed in the comments - the View Rendered Source Firefox extension, and the HTML Validator for Firefox.
voice your opinion now!
snipped match div tags validator firefox extension snipped match div tags validator firefox extension
|
Community Events
Don't see your event here? Let us know!
|