Karmazzin
Karmazzin

Reputation: 531

As the symfony add html in the widget

I make a widget for entering a phone number, extends from sfWidgetFormInputText. The goal is to add <span>+7<span>.

How to implement it?

Upvotes: 0

Views: 124

Answers (1)

Visav&#236;
Visav&#236;

Reputation: 2333

Your widget class:

class MyWidgetFormInputPhoneNumber extends sfWidgetFormInputText 
{

    public function render($name, $value = null, $attributes = array(), $errors = array())
    {
        return '<span>+7</span> '.parent::render($name, $value, $attributes, $errors);
    }
}

Upvotes: 1

Related Questions