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]...

Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


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