Lançado Adianti Framework 7.6!
Clique aqui para saber mais
problema com imput template theme 4 precisei fazer um notebook mas os inputs do template thema4 desconfigura segue imagem: [img]http://i67.tinypic.com/wrh0ud.png[/img]...
Pacotão Dominando o Adianti Framework 7
O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado! Versão 7.4


Dominando o Adianti 7 Quero me inscrever agora!

Comentários (2)


NR

Use a classe BoostrapFormBuilder:
adianti.com.br/framework_files/tutor/index.php?class=FormBuilderView
RS

Nataniel, resolveu, só está demora mais para abrir o formulário, não sei porque.

  1. <?php
  2. /**
  3.  * FornecedoresForm Form
  4.  * @author  <your name here>
  5.  */
  6. class FornecedoresForm extends TPage
  7. {
  8.     protected $form// form
  9.     
  10.     /**
  11.      * Form constructor
  12.      * @param $param Request
  13.      */
  14.     public function __construct$param )
  15.     {
  16.         parent::__construct();
  17.         
  18.         TScript::create('setTimeout(function() { $("input[name=\'a_nome\']").focus() }, 500);');
  19.      
  20.       
  21.         $this->form = new BootstrapFormBuilder;
  22.         $this->form->setFormTitle('Fornecedor');
  23.         
  24.         $l_a_nume = new TLabel('Numero');
  25.         $l_a_nume->style='text-align:left;width:20%';
  26.         
  27.         // create the form fields
  28.         $a_codi = new TEntry('a_codi');
  29.         $a_nome = new TEntry('a_nome');
  30.         $a_fant = new TEntry('a_fant');
  31.         $a_ende = new TEntry('a_ende');
  32.         $a_nume = new TEntry('a_nume');
  33.         $a_bair = new TEntry('a_bair');
  34.         $a_cep = new TEntry('a_cep');
  35.         $a_esta = new TEntry('a_esta');
  36.         $a_cida = new TEntry('a_cida');
  37.         $a_insc = new TEntry('a_insc');
  38.         $a_cnpj = new TEntry('a_cnpj');
  39.         $a_tele = new TEntry('a_tele');
  40.         $a_cont = new TEntry('a_cont');
  41.         $a_telx = new TEntry('a_telx');
  42.         $a_obse = new TEntry('a_obse');
  43.         $a_pra1 = new TEntry('a_pra1');
  44.         $a_pra2 = new TEntry('a_pra2');
  45.         $a_fax = new TEntry('a_fax');
  46.         $a_caip = new TEntry('a_caip');
  47.         $a_coco = new TEntry('a_coco');
  48.         $a_emai = new TEntry('a_emai');
  49.         $a_sait = new TEntry('a_sait');
  50.         $a_repr = new TEntry('a_repr');
  51.         $a_enre = new TEntry('a_enre');
  52.         $a_bare = new TEntry('a_bare');
  53.         $a_cire = new TEntry('a_cire');
  54.         $a_esre = new TEntry('a_esre');
  55.         $a_tere = new TEntry('a_tere');
  56.         $a_ban1 = new TEntry('a_ban1');
  57.         $a_ban2 = new TEntry('a_ban2');
  58.         $a_ban3 = new TEntry('a_ban3');
  59.         $a_ban4 = new TEntry('a_ban4');
  60.         $a_fare = new TEntry('a_fare');
  61.         $a_emre = new TEntry('a_emre');
  62.         $a_cepr = new TEntry('a_cepr');
  63.         $a_core = new TEntry('a_core');
  64.         $a_celu = new TEntry('a_celu');
  65.         $a_codi->setSize('10%');
  66.         $a_nome->setSize('90%');
  67.         $a_fant->setSize('90%');
  68.         $a_ende->setSize('90%');
  69.         $a_nume->setSize('30%'); 
  70.         $a_bair->setSize('90%'); 
  71.         $a_cep->setSize('40%');
  72.         $a_esta->setSize('10%'); 
  73.         $a_cida->setSize('90%'); 
  74.         $a_insc->setSize('40%'); 
  75.         $a_cnpj->setSize('40%');
  76.         $a_tele->setSize('90%'); 
  77.         $a_cont->setSize('90%'); 
  78.         $a_telx->setSize('90%'); 
  79.         $a_obse->setSize('90%'); 
  80.         $a_pra1->setSize('90%'); 
  81.         $a_pra2->setSize('90%'); 
  82.         $a_fax ->setSize('90%');
  83.         $a_caip->setSize('90%'); 
  84.         $a_coco->setSize('90%'); 
  85.         $a_emai->setSize('90%'); 
  86.         $a_sait->setSize('90%'); 
  87.         $a_repr->setSize('90%'); 
  88.         $a_enre->setSize('90%'); 
  89.         $a_bare->setSize('90%'); 
  90.         $a_cire->setSize('90%'); 
  91.         $a_esre->setSize('90%'); 
  92.         $a_tere->setSize('90%'); 
  93.         $a_ban1->setSize('90%'); 
  94.         $a_ban2->setSize('90%'); 
  95.         $a_ban3->setSize('90%'); 
  96.         $a_ban4->setSize('90%'); 
  97.         $a_fare->setSize('90%'); 
  98.         $a_emre->setSize('90%'); 
  99.         $a_cepr->setSize('90%'); 
  100.         $a_core->setSize('90%'); 
  101.         $a_celu->setSize('90%'); 
  102.         // add the fields
  103.         $this->form->appendPage('Principal');
  104.         
  105.         
  106.          //$this->form = new BootstrapFormWrapper($this->form);
  107.         
  108.         $this->form->addFields(['Código'],[$a_codi]);
  109.         
  110.         
  111.                
  112.         $this->form->addFields(['Nome'], [$a_nome]);
  113.         
  114.         $this->form->addFields(['Fantasia'], [$a_fant] );
  115.                 
  116.         $this->form->addFields(['Endereço'],[$a_ende],[$l_a_nume], [$a_nume] );
  117.         
  118.         //$this->form->addFields(['Numero'], [$a_nume] );
  119.         
  120.         
  121.         $this->form->addFields(['Bairro'], [$a_bair]);
  122.         
  123.         $this->form->addFields(['Cidade'], [$a_cida]);
  124.         
  125.         $this->form->addFields(['Estado'], [$a_esta]);
  126.         
  127.         $this->form->addFields(['CEP'], [$a_cep]);
  128.         
  129.         $this->form->addFields(['CNPJ/CPF'], [$a_cnpj]);
  130.         
  131.         $this->form->addFields(['Inscrição Estadual'], [$a_insc]);
  132.         
  133.         $this->form->addFields(['Telefone'], [$a_tele]);
  134.         
  135.         $this->form->addFields(['Celular'], [$a_telx]);
  136.         
  137.         $this->form->addFields(['Fax'], [$a_fax]);
  138.         
  139.         $this->form->addFields(['Nome Contato'], [$a_cont] );
  140.         
  141.         $this->form->addFields(['Observação(ões)'], [$a_obse]);
  142.         
  143.         $this->form->addFields(['Praça Pgto'], [$a_pra1]);
  144.         
  145.         $this->form->addFields(['Praça Pgto'], [$a_pra2]);
  146.         
  147.         $this->form->addFields(['Caixa Postal'],[$a_caip]);
  148.         
  149.         $this->form->addFields(['E-Mail'],[$a_emai]);
  150.         
  151.         $this->form->addFields(['Home-page'],[ $a_sait]);
  152.         
  153.         
  154.         $this->form->appendPage('Representante');
  155.         
  156.         $this->form->addFields(['Nome Representante'],[$a_repr]);
  157.         $this->form->addFields(['Endereço'],[$a_enre]);
  158.         $this->form->addFields(['Bairro'],[$a_bare]);
  159.         $this->form->addFields(['Cidade'],[$a_cire]);
  160.         $this->form->addFields(['Estado'],[$a_esre]);
  161.         $this->form->addFields(['CEP'],[$a_cepr]);
  162.         $this->form->addFields(['Telefone'],[$a_tere]);
  163.         $this->form->addFields(['Celular'],[$a_celu]);
  164.         $this->form->addFields(['Fax'],[$a_fare]);
  165.         $this->form->addFields(['E-Mail'],[$a_emre]);
  166.         
  167.         $this->form->appendPage('Dados Bancários');
  168.         
  169.         $this->form->addFields(['Banco'],[$a_ban1]);
  170.         
  171.         $this->form->addFields(['Banco'],[$a_ban2]);
  172.         
  173.         $this->form->addFields(['Banco'],[$a_ban3]);
  174.         
  175.         $this->form->addFields(['Banco'],[$a_ban4]);
  176.         
  177.         $a_nome->forceUpperCase();
  178.         
  179.         if (!empty($a_codi))
  180.         {
  181.             $a_codi->setEditable(FALSE);
  182.         }
  183.         
  184.         /** samples
  185.          $this->form->addQuickFields('Date', array($date1, new TLabel('to'), $date2)); // side by side fields
  186.          $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
  187.          $fieldX->setSize( 100, 40 ); // set size
  188.          **/
  189.          
  190.         // create the form actions
  191.         $this->form->addAction(_t('Save'), new TAction(array($this'onSave')), 'fa:floppy-o');
  192.         $this->form->addAction(_t('New'),  new TAction(array($this'onClear')), 'bs:plus-sign green');
  193.         $this->form->addAction('Voltar',  new TAction(array('FornecedoresList''onReload')), 'fa:undo blue');
  194.         
  195.         
  196.         $container = new TVBox;
  197.         $container->style 'width: 100%';
  198.         $container->add($this->form);
  199.         
  200.       //  parent::add($this->form);
  201.      //  $container->add(TPanelGroup::pack('Cliente', $this->form));
  202.         parent::add($container);
  203.        
  204.     }
  205.     /**
  206.      * Save form data
  207.      * @param $param Request
  208.      */
  209.     public function onSave$param )
  210.     {
  211.         try
  212.         {
  213.             TTransaction::open('scomcomercio'); // open a transaction
  214.             
  215.             /**
  216.             // Enable Debug logger for SQL operations inside the transaction
  217.             TTransaction::setLogger(new TLoggerSTD); // standard output
  218.             TTransaction::setLogger(new TLoggerTXT('log.txt')); // file
  219.             **/
  220.             
  221.             $this->form->validate(); // validate form data
  222.             
  223.             $object = new Fornecedores;  // create an empty object
  224.             $data $this->form->getData(); // get form data as array
  225.             $object->fromArray( (array) $data); // load the object with data
  226.             $object->store(); // save the object
  227.             
  228.             // get the generated a_codi
  229.             $data->a_codi $object->a_codi;
  230.             
  231.             $this->form->setData($data); // fill form data
  232.             TTransaction::close(); // close the transaction
  233.             
  234.             new TMessage('info'TAdiantiCoreTranslator::translate('Record saved'));
  235.         }
  236.         catch (Exception $e// in case of exception
  237.         {
  238.             new TMessage('error'$e->getMessage()); // shows the exception error message
  239.             $this->form->setData$this->form->getData() ); // keep form data
  240.             TTransaction::rollback(); // undo all pending operations
  241.         }
  242.     }
  243.     
  244.     /**
  245.      * Clear form data
  246.      * @param $param Request
  247.      */
  248.     public function onClear$param )
  249.     {
  250.         $this->form->clear(TRUE);
  251.     }
  252.     
  253.     /**
  254.      * Load object to form data
  255.      * @param $param Request
  256.      */
  257.     public function onEdit$param )
  258.     {
  259.         try
  260.         {
  261.             if (isset($param['key']))
  262.             {
  263.                 $key $param['key'];  // get the parameter $key
  264.                 TTransaction::open('scomcomercio'); // open a transaction
  265.                 $object = new Fornecedores($key); // instantiates the Active Record
  266.                 $this->form->setData($object); // fill the form
  267.                 TTransaction::close(); // close the transaction
  268.             }
  269.             else
  270.             {
  271.                 $this->form->clear(TRUE);
  272.             }
  273.         }
  274.         catch (Exception $e// in case of exception
  275.         {
  276.             new TMessage('error'$e->getMessage()); // shows the exception error message
  277.             TTransaction::rollback(); // undo all pending operations
  278.         }
  279.     }
  280. }
  281.  ?>
</your>