2009年11月13日星期五

Re: [fw-mvc] Changing the size attribute of a validationtextbox element

That still did not work.  Maybe it's something to do with my configuration:

Zend Server CE running locally
Zend Studio 7.0.2
PHP 5.2.6
Zend Framework 1.9.0 (r17310)

Is there another alternative, such as applying a decorator to this object?  If so, which decorator would allow me to change the styling on this particular object?

On Fri, Nov 13, 2009 at 10:07 AM, Rob Keplin <rkeplin@acsacc.com> wrote:
I have something like this, which works:

$this->addElement(
            'ValidationTextBox',
            'zip_code',
            array(
                'label'        => 'Zip Code',
                'trim'        => true,
                'maxLength' => 5,
                'required'    => true,
                'regExp'    => '^[0-9]{5,5}$',
                'invalidMessage' => 'Valid Zip Code Required. Ex: 90210'
            )
        );



Andrew Sledge wrote:
Alas, still no.  At this point I think I've tried just about every combination possible.

On Fri, Nov 13, 2009 at 9:27 AM, Wouter de Gooijer <wouterdegooijer@gmail.com> wrote:
Try this:

$this->addElement('ValidationTextBox', 'name', array(

        'label'      => 'Name:',

                   
'attribs'     => array(
                'size' => 8,
                'maxLength' => 8,
           ),


        'required'   => true,

        'filters'    => array('StringTrim'),

        'regExp' => $regex,

        'validators' => array(

            array('Regex',false,array('/^'.$regex.'$/'))

        ),


On Fri, Nov 13, 2009 at 15:06, Andrew Sledge <andrew.j.sledge@gmail.com> wrote:
Unfortunately, this doesn't work.  I've tried applying options size, max, maximum, and maxlength with no desirable outcome.


On Fri, Nov 13, 2009 at 6:23 AM, J DeBord <jasdebord@gmail.com> wrote:

On Fri, Nov 13, 2009 at 4:33 AM, Andrew Sledge <andrew.j.sledge@gmail.com> wrote:
Hello all,

This is in relation to Zend_Form.  Apparently I'm missing the obvious, but how do you change the size attribute of a ValidationTextbox element?

$this->addElement('ValidationTextBox', 'name', array(

        'label'      => 'Name:',

        'size' => 8,


        'required'   => true,

        'filters'    => array('StringTrim'),

        'regExp' => $regex,

        'validators' => array(

            array('Regex',false,array('/^'.$regex.'$/'))

        ),
Here is my element

$this->addElement('ValidationTextBox', 'name', array(
'label'      => 'Name:',
'required'   => true,
'filters'    => array('StringTrim'),
'regExp' => $regex,            
'validators' => array(
array('Regex',false,array('/^'.$regex.'$/'))
),
'decorators' => array(
array('DijitElement', array('maxlength' => 1)),
'Errors',
array('HtmlTag', array('tag' => 'div')),
array('Label', array('tag' => 'div')),
array('Description', array('tag' => 'div')),
),
));

I want the input element to have the size attribute to have 8.  Any and all help is most appreciated.

--
Andrew Sledge


--
Andrew Sledge

Yours,

Wouter de Gooijer



--
Andrew Sledge



--
Andrew Sledge

没有评论: