_getNewForm(); if ($form->validate()) { $data = $form->getValues(); $this->_addItem([ 'tpl' => $this->getTemplate('text.tpl'), 'text' => '

Submitted Data

' . var_export($data, true) . '
', ]); } $this->_addFormItem($form); return $this; } protected function _getNewForm(array $options = []) { $options = $this->_getFormOptions(); $options['hasButtons'] = false; $form = new Qs_Form($options); $form->addElement('hidden', 'action', ['value' => 'insert']); $this->_bindFormFields($form); $form->addButtons(); return $form; } protected function _bindFormFields(Qs_Form $form) { $form->addElement('header', 'phoneHeader', ['label' => 'Phone Element']); $form->addElement('phone', 'phoneDash1', ['label' => 'Phone Dash #1', 'format' => Qs_Form_Element_Phone::DASH_FORMAT]); $form->addElement('phone', 'phoneDot1', ['label' => 'Phone Dot #1']); $form->addElement( 'phone', 'phoneDash2', [ 'label' => 'Phone Dash #2', 'format' => Qs_Form_Element_Phone::DASH_FORMAT, 'placeholder' => false, 'required' => true, 'value' => '(555) 555-5555', 'description' => 'Placeholder disabled', ] ); $form->addElement( 'phone', 'phoneDot2', [ 'label' => 'Phone Dot #2', 'required' => true, 'value' => '555.444.3333', ] ); $form->addElement('header', 'internationalHeader', ['label' => 'International Phone Element']); $form->addElement( 'internationalTel', 'inPhone1', [ 'label' => 'International Phone 1', 'value' => '+380965554321', 'defaultCountry' => 'ua', 'preferredCountries' => ['ua', 'pl', 'de'], ] ); $form->addElement( 'internationalTel', 'inPhone2', [ 'label' => 'International Phone 2', 'defaultCountry' => 'us', 'preferredCountries' => [], 'onlyCountries' => ['us', 'ca', 'mx'], ] ); return $this; } }