When rendering my form with the following element after having entered a
string that would not match the regex pattern,

I get my correct error message. Unfortunately there is no hint what was
typed in since the element’s input remains empty.

How can I get back the “invalid” value?



        $keyElement = $this->createElement('validationTextBox', 'key')

            ->setLabel('admin_form_customer_key_label')

            ->setDescription('admin_form_customer_key_description')

            ->setRequired(true)

            ->addValidator('regex', true, array(
'/^[\p{L}0-9][\p{L}0-9-]{0,31}$(?<!-)/u'))

            ->addValidator('stringLength', true, array(3, 40))

            ->addValidator($keyExistsValidator)

            ->addFilter('StringToLower')

            ->setErrorMessages(array(

                'admin_form_customer_key_error'

            ))

            ->setDijitParams(array(

                'trim' => 'true',

                'lowercase' => 'true',

                'maxlength' => 40,

                'regExp' => '^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$',

                'intermediateChanges' => 'true'

            ));

        $this->addElement($keyElement);

Reply via email to