function onView() { //Obtem dados do Formulario $data = $this->form->getData(); //Atribui os dados de volta ao Formulario $this->form->setData($data); //Cria uma Janela $window = new TWindow('Dados do Formulario'); //Define posição e tamanho $window->setPosition('300', '70'); $window->setSize('300', '150'); //Monta o Texto a ser Exibido $output = "Nome: {$data->Nome}\n"; $output .= "Email: {$data->Email}\n"; $output .= "Titulo: {$data->Titulo}\n"; $output .= "Mensagem:\n{$data->Mensagem}\n"; //Cria o Objeto de Texto $texto = new TText('TEXTO', '300'); $texto->setSize('290', '120'); $texto->setValue($output); //Adiciona o objeto a janela $window->add($texto); $window->show(); } function onSend() { //SEM IMPLEMENTAÇÃO } } $pagina = new emailForm(); $pagina->show();
<?php require './form.class.php'; // Give the form a name. This is used to identify which form is submitted in emails. $form = new emailForm('iServe Signup'); /* Create form fields * The field parameters are in this order: * type, name, id(optional), required, maxlength, size(will be cols for textarea), rows(textarea only), * datatype(type of data the field should contain, see notes in form.class.php for types), value(optional) */ $form->addField('text', 'name', 'name', true, 50, 30); $form->addField('text', 'address', 'address', false, 50, 30, '', 'alphanumeric'); $form->addField('text', 'city', 'city', false, 80, 30, '', 'letters'); $form->addField('text', 'state', 'state', false, 30, 30, '', 'letters'); $form->addField('text', 'zip', 'zip', false, 5, 30, '', 'numbers'); $form->addField('text', 'email', 'email', true, 75, 30, '', 'email'); $form->addField('text', 'phone', 'phone', false, 12, 30, '', 'phone'); $form->addField('text', 'cell', 'cell', false, 12, 30, '', 'phone'); $form->addField('text', 'best', 'best', false, 30, 30, ''); $form->addField('textarea', 'comments', '', false, '', 30, 6, ''); $form->addField('submit', 'submit', '', '', '', '', '', '', 'Submit'); // MUST be called after adding fields so it can be validated accordingly. $res = false; if (isset($_POST) && !empty($_POST)) { $res = $form->submitForm($_POST); } // Display result message if ($res) { echo 'Thank you for contacting us. We will be in touch with you very soon.'; } else { if (!$res && count($form->errors) > 0) {