 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
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
Script-Tutorials.com: Form Validation with Javascript and PHP
by Chris Cornutt February 02, 2012 @ 09:07:40
On the Script-Tutorials.com site today there's a new tutorial about form validation using a combination of jQuery on the frontend and PHP on the backend.
In this tutorial, I will show you how to create an attractive, pleasant to look form for your website and then I will explain you how to dynamically validate them using Javascript. We'll also cover server-side validation with PHP to make everything 100% safe. This tutorial will help you to add more functionality to your forms which leads to better user experience and better quality of your website.
His sample form (name, password, email and gender) is made from some pretty simple HTML markup. The real trick comes with the jQuery validation on each field handled in an onKeyUp. Included are both a "password strength" method and an email validation method to check the format of the address. Errored fields have their background color changed to indicate that they've failed and some basic validation (length, password match, etc.) are also included. The PHP does much of the same validation once the form is posted and returns any error messages that might have come up.
You can download the code or try out a live demo to see the scripts together in action.
voice your opinion now!
form validation jquery javascript frontend backend tutorial
Henrik Bjørnskov's Blog: Symfony2 How to do a Wizard (multistep form) with Doctrine2
by Chris Cornutt November 03, 2011 @ 09:13:51
Henrik Bjørnskov has a new post with a technique you can use to combine Symfony2 and Doctrine2 to create a multi-step form (a wizard) without having to worry about lost user information between steps.
The easy ways is doing it with Javascript and just show/hide the correct fieldsets when needed. The downside with this approach is that the data is only saved and validated once at the end. So if the user reloads the page the entered information is gone. The other way is to have every Step in the Wizard being a seperate form and validate the data based on what step you are on and save the necessary fields.
For his method, he created a Manager class with a StepInterface that returns the correct field names, forms and template information to render. The interface code is included in the post as well as an example of it in use setting up the wizard object, making a report and getting the correct step information from the wizard.
voice your opinion now!
wizard multistep form doctrine2 symfony2 framework
ZetCode.com: SQLite PHP tutorial
by Chris Cornutt October 17, 2011 @ 12:12:48
If you're in the process of prototyping a site or just need a lightweight storage tool for your application, you might look into SQLite. Fortunately, PHP has direct support for it and this great tutorial from ZetCode.com will introduce you to some of the basic concepts you'll need to get working (it's a bit older, but still very useful).
This is a PHP programming tutorial for the SQLite database. It covers the basics of SQLite programming with PHP language. There are two ways to code PHP scripts with SQLite library. We can use procedural functions or OOP objects and methods. In this tutorial, we use the classical procedural style. You might also want to check the PHP tutorial or SQLite tutorial on ZetCode.
They go through the basic installation (on a linux platform, but easily adapted to others) including changes to your php.ini and the creation and use of a first sample database. You'll find the interface very similar to some of its other RDBMS cousins with a few exceptions. They show you the CRUD basics - creating records, reading the contents of a table, updating data already there and deleting records. There's also a simple form tutorial that takes a name and gender and does the inserts.
voice your opinion now!
sqlite tutorial crud form example
WebInOne.net: Date validation for CodeIgniter 2
by Chris Cornutt October 07, 2011 @ 11:57:21
On the WebInOne blog there's a post about doing some date validation in CodeIgniter 2 forms using the "set_validation" method.
I wrote a tutorial here about the CI date. At that post I used the HTML <select> for the input of date. Sometime our client can want to use text box for the date input. We need the validation for this date. I have found this code from here. It is for CI 1.7.* and PHP 5.2.*. So I change some code for the CI 2.0.* and PHP 5.3.*.
There's some code snippets included in the post showing how to use it in the form (HTML), setting the validation on the form object (for US and UK validation) and the actual code of the updated custom Validation class.
voice your opinion now!
date validation tutorial framework snippet form
Jason Gilmore's Blog: How I Learned to Stop Worrying and Love Zend_Form
by Chris Cornutt August 22, 2011 @ 13:57:14
On his blog today Jason Gilmore has a quick post about solving one of his frustrations with Zend_Form (a part of the Zend Framework) - the default form decorators.
It is a fantastically productive framework, one which I happen to use almost every single day. There was however one feature which absolutely drove me crazy. The Zend_Form component's uses the dd, dl, and dt elements as the default form markup decorators, meaning that even a simple contact form consisting of name, email, and message fields and a submit button [is marked up with dl, dt and dds]. [...] It goes without saying that the overwhelming majority of developers do not use these elements to mark up their forms, with the sheer number of questions posted to StackOverflow and elsewhere about getting rid of these decorators backing this assertion.
He gives his simple solution to the issue, something better than removing all of the decorators and using setDecorator to replace them - a simple partial view that echos out the fields directly. The trick is to use the setDecorators call with a "ViewScript" option pointing to your partial and setElementDecorators() call to use a "ViewHelper".
voice your opinion now!
zendform tutorial markup decorator form
Court Ewing's Blog: Create and Validate a Choice List in a Symfony 2 Form
by Chris Cornutt August 17, 2011 @ 08:28:21
Court Ewing has written up a new post to his blog about creating a "choice" list (a select list as defined by Symfony 2) with dynamic options and validating the resulting submission. His example uses Doctrine 2 entities to work with most of the data handling.
A standard select list can be created using Symfony's choice field type; it is pretty clear how to create a new choice field with simple, non-dynamic options (e.g. gender), but it gets a little more complicated when you want to create and validate a dynamically generated choice list.
He includes the code for a simple entity, a Post model to fetch the category information and the set up of the form element - a select list of post types/categories. He also includes a bonus section showing how you can achieve the same thing without a model to bind to.
The code's a little bit more complex than the previous example, but it's basically just reproducing some of the validation and fetching logic manually.
voice your opinion now!
create validate tutorial symfony2 form select choice dynamic
Ian Christian's Blog: Creating a custom form field type in Symfony 2
by Chris Cornutt August 16, 2011 @ 12:04:37
Ian Christian has added a new post to his blog today showing how you can create a custom form field type in Symfony 2 by extending the AbstractType.
I am finally starting to dive into symfony 2 properly. Yes - it's taken a while, work has taken me in different directions! I found myself needing to create a custom form field type pretty quickly, but couldn't find much in the way of documentation to do so, so I thought I'ld throw it up here; partly to help others, but mostly to get feedback to make sure I'm not approaching this from the wrong angle.
He includes the code that creates his custom "Person" model and the class to create his "transport type" select box that pulls in its values from a "choice list" class. He registers it in his bundle and it can then be included in his buildForm() method just like any other form field.
voice your opinion now!
symfony tutorial custom form field select abstract
StackOverflow.com: The Definitive Guide To Forms based Website Authentication
by Chris Cornutt August 12, 2011 @ 12:13:35
If you haven't seen it yet, there's a post over on StackOverflow that's been growing over the past few days about form-based authentication in websites. The author wants to make a definitive resource for people to use when making good, secure user authentication systems.
Please help us create the definitive resource for this topic. We believe that stackoverflow should not just be a resource for very specific technical questions, but also for general guidelines on how to solve variations on common problems. "Form Based Authentication For Websites" should be a fine topic for such an experiment.
They want to include topics like logins, storing passwords, "forgot password" security, OpenID, browser autocompletion, password strength, email validation and more. They already laid out eight different sections with summaries including:
- How To Remain Logged In - The Infamous "Remember Me" Checkbox
- Using Secret Questions
- Checking Password Strength
- Much More - Or: Preventing Rapid-Fire Login Attempts
- Two-Factor Authentication and Authentication Providers
There's some good feedback from other users with other suggestions and links to external resources that could shed some more light on the topic.
voice your opinion now!
guide form security user authentication website
|
Community Events
Don't see your event here? Let us know!
|