CD
TEntry->forceUpperCase()
Pessoal,
Estou usando Adianti Framework 7 e ao tentar utilizar os métodos forceUpperCase () e forceLowerCase() estou tendo o seguinte erro:
Fatal error: Uncaught Error: Call to undefined function forceUpperCase() in C:xampphtdocsocorrenciasappcontrolBzmAgenteForm.php:45
Stack trace:
#0 C:xampphtdocsocorrenciaslibadianticoreAdiantiCoreApplication.php(80): BzmAgenteForm->__construct(Array)
#1 C:xampphtdocsocorrenciasengine.php(27): AdiantiCoreAdiantiCoreApplication::run('1')
#2 C:xampphtdocsocorrenciasengine.php(68): TApplication::run()
#3 {main}
thrown in C:xampphtdocsocorrenciasappcontrolBzmAgenteForm.php on line 45
Estou usando Adianti Framework 7 e ao tentar utilizar os métodos forceUpperCase () e forceLowerCase() estou tendo o seguinte erro:
Fatal error: Uncaught Error: Call to undefined function forceUpperCase() in C:xampphtdocsocorrenciasappcontrolBzmAgenteForm.php:45
Stack trace:
#0 C:xampphtdocsocorrenciaslibadianticoreAdiantiCoreApplication.php(80): BzmAgenteForm->__construct(Array)
#1 C:xampphtdocsocorrenciasengine.php(27): AdiantiCoreAdiantiCoreApplication::run('1')
#2 C:xampphtdocsocorrenciasengine.php(68): TApplication::run()
#3 {main}
thrown in C:xampphtdocsocorrenciasappcontrolBzmAgenteForm.php on line 45
- <?php
- /**
- * BzmAgenteForm Form
- * @author <your name here>
- */
- class BzmAgenteForm extends TPage
- {
- protected $form; // form
-
- /**
- * Form constructor
- * @param $param Request
- */
- public function __construct( $param )
- {
- parent::__construct();
-
-
- // creates the form
- $this->form = new BootstrapFormBuilder('form_BzmAgente');
- $this->form->setFormTitle('Cadastro de Agentes');
-
- // create the form fields
- $ID_AGENTE = new TEntry('ID_AGENTE');
- $NOME = new TEntry('NOME');
- $CONTATO = new TEntry('CONTATO');
- $CELULAR = new TEntry('CELULAR');
- $FONE = new TEntry('FONE');
- $EMAIL = new TEntry('EMAIL');
- // add the fields
- $this->form->addFields( [ new TLabel('Id:') ], [ $ID_AGENTE ] );
- $this->form->addFields( [ new TLabel('Nome:') ], [ $NOME ] );
- $this->form->addFields( [ new TLabel('Contato:') ], [ $CONTATO ] );
- $this->form->addFields( [ new TLabel('Celular:') ], [ $CELULAR ] );
- $this->form->addFields( [ new TLabel('Fone:') ], [ $FONE ] );
- $this->form->addFields( [ new TLabel('Email:') ], [ $EMAIL ] );
- $NOME->addValidation('NOME', new TRequiredValidator);
- $EMAIL->addValidation('E-mail', new TEmailValidator);
- $NOME->forceUpperCase();
- $CONTATO>forceUpperCase();
- $CELULAR->setmask('(00) 00000-0000');
- $FONE->setmask('(00) 0000-0000');
- $EMAIL->forceLowerCase();
- $NOME->setMaxLength(50);
- $CONTATO->setMaxLength(50);
- $CELULAR->setMaxLength(20);
- $FONE->setMaxLength(20);
- $EMAIL->setMaxLength(50);
- // set sizes
- $ID_AGENTE->setSize('8%');
- $NOME->setSize('70%');
- $CONTATO->setSize('70%');
- $CELULAR->setSize('15%');
- $FONE->setSize('15%');
- $EMAIL->setSize('40%');
- if (!empty($ID_AGENTE))
- {
- $ID_AGENTE->setEditable(FALSE);
- }
-
- /** samples
- $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
- $fieldX->setSize( '100%' ); // set size
- **/
-
- // create the form actions
- $btn = $this->form->addAction(_t('Save'), new TAction([$this, 'onSave']), 'fa:save');
- $btn->class = 'btn btn-sm btn-primary';
- $this->form->addActionLink(_t('New'), new TAction([$this, 'onEdit']), 'fa:eraser red');
-
- // vertical box container
- $container = new TVBox;
- $container->style = 'width: 100%';
- // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
- $container->add($this->form);
-
- parent::add($container);
- }
- /**
- * Save form data
- * @param $param Request
- */
- public function onSave( $param )
- {
- try
- {
- TTransaction::open('datasiop'); // open a transaction
-
- /**
- // Enable Debug logger for SQL operations inside the transaction
- TTransaction::setLogger(new TLoggerSTD); // standard output
- TTransaction::setLogger(new TLoggerTXT('log.txt')); // file
- **/
-
- $this->form->validate(); // validate form data
- $data = $this->form->getData(); // get form data as array
-
- $object = new BzmAgente; // create an empty object
- $object->fromArray( (array) $data); // load the object with data
- $object->store(); // save the object
-
- // get the generated ID_AGENTE
- $data->ID_AGENTE = $object->ID_AGENTE;
-
- $this->form->setData($data); // fill form data
- TTransaction::close(); // close the transaction
-
- new TMessage('info', AdiantiCoreTranslator::translate('Record saved'));
- }
- catch (Exception $e) // in case of exception
- {
- new TMessage('error', $e->getMessage()); // shows the exception error message
- $this->form->setData( $this->form->getData() ); // keep form data
- TTransaction::rollback(); // undo all pending operations
- }
- }
-
- /**
- * Clear form data
- * @param $param Request
- */
- public function onClear( $param )
- {
- $this->form->clear(TRUE);
- }
-
- /**
- * Load object to form data
- * @param $param Request
- */
- public function onEdit( $param )
- {
- try
- {
- if (isset($param['key']))
- {
- $key = $param['key']; // get the parameter $key
- TTransaction::open('datasiop'); // open a transaction
- $object = new BzmAgente($key); // instantiates the Active Record
- $this->form->setData($object); // fill the form
- TTransaction::close(); // close the transaction
- }
- else
- {
- $this->form->clear(TRUE);
- }
- }
- catch (Exception $e) // in case of exception
- {
- new TMessage('error', $e->getMessage()); // shows the exception error message
- TTransaction::rollback(); // undo all pending operations
- }
- }
- }
Carlos
Veja a linha abaixo, está errado. Acredito que seja isso!