Symfony + wForms

I’ve been using the following library a couple of times.

There is a topic related to wForms on Symfony:

where using of sfFormValidationPlugin is proposed to be used.

Well, I agree that AJAX validation is great solution but in my case I like wForms since they provide cool javascript/css-based solutions for web forms.

Are you interested? If so here is the way how I do that:

1. Download compressed wForms version:
and pickup + download CSS you prefer:

Put wforms.js into js folder and wforms.css into css folder. There may be also a couple of images which I’d recommend to put into images/wforms/ and modify wforms.css so it contains correct path to images.

2. Next step modify your view.yml so it has

stylesheets: [ wforms ]

javascripts: [ wforms ]

3. Put the form html into your templates, e.g.


<div class=”oneField”>
<label class=”preField”>Name</label>
<?php echo input_tag(‘name’, $sf_data->get(‘sf_params’)->get(‘name’), array(‘size’ => 40)) ?>
<span class=”reqMark”>*</span>

<div class=”oneField”>
<label class=”preField”>Email</label>
<?php echo input_tag(’email’, $sf_data->get(‘sf_params’)->get(’email’), array(‘size’ => 40)) ?>
<span class=”reqMark”>*</span>


That’s it.

As aside note, I’ve figured out that wforms overrides all your forms so if you’d like to have different layout for different forms you’d need to use the following trick (that’s what I figured out but maybe there are better ways):

put your form element into the following tags:

<span class=”oneChoice”>…</span>

and this way you would have wForms style cleaned out.

Leave a Reply

Your email address will not be published. Required fields are marked *