Ver Mensaje Individual
  #5 (permalink)  
Antiguo 14/03/2013, 17:55
DeivyPereira
 
Fecha de Ingreso: marzo-2013
Mensajes: 10
Antigüedad: 11 años, 1 mes
Puntos: 0
Respuesta: Combobox Dependientes Buscador

Lo tengo con los datos del JavaScript que mencione arriba y mi archivo test.php dice algo asi:

Código PHP:
Ver original
  1. <?php
  2. require 'classes/Form.class.php';
  3. require 'classes/DataAccess.class.php';
  4. require 'classes/ElementsFromDB.class.php';
  5. require 'classes/LinkedSelect.class.php';
  6.  
  7. $form=new Form('form', 'post');
  8.  
  9. $form->AddInput(array(
  10.     'elementsfromdb'=>array(
  11.         'table'=>'categoria',
  12.         'values'=>'nombre',
  13.         'options'=>'nombre',
  14.     ),
  15.     'attributes'=>array(
  16.         'type'=>'select',
  17.         'id'=>'select_1',
  18.         'name'=>'select_1'
  19.     ),
  20.     'externalclass'=>'elementsfromdb',
  21.     'selected'=>'1',
  22.     'default'=>array(
  23.         'value'=>'0',
  24.         'option'=>'Elige...'
  25.     )
  26. ));
  27. $form->AddInput(array(
  28.     'elementsfromdb'=>array(
  29.         'table'=>'marca',
  30.         'values'=>'nombre',
  31.         'options'=>'nombre',
  32.     ),
  33.     'attributes'=>array(
  34.         'type'=>'select',
  35.         'id'=>'select_2',
  36.         'name'=>'select_2'
  37.     ),
  38.     'externalclass'=>'linkedselect',
  39.     'linkedby'=>array(
  40.         'reference'=>'categoria',
  41.         'id'=>'select_1',
  42.         'showdefault'=>'0'
  43.     ),
  44.     'default'=>array(
  45.         'value'=>'0',
  46.         'option'=>'Elige...'
  47.     ),
  48.     'locations'=>array(
  49.         'js'=>'js/',
  50.         'php'=>'classes/'
  51.     )
  52. ));
  53. $form->AddInput(array(
  54.     'elementsfromdb'=>array(
  55.         'table'=>'producto',
  56.         'values'=>'id',
  57.         'options'=>'title',
  58.     ),
  59.     'attributes'=>array(
  60.         'type'=>'select',
  61.         'id'=>'select_3',
  62.         'name'=>'select_3'
  63.     ),
  64.     'externalclass'=>'linkedselect',
  65.     'linkedby'=>array(
  66.         'reference'=>'marca',
  67.         'id'=>'select_2',
  68.         'showdefault'=>'0'
  69.     ),
  70.     'default'=>array(
  71.         'value'=>'0',
  72.         'option'=>'Elige...'
  73.     ),
  74.     'locations'=>array(
  75.         'js'=>'js/',
  76.         'php'=>'classes/'
  77.     )
  78. ));
  79. $form->GenerateForm();
  80. ?>


y en el body dice algo como:
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <?php $form->GenerateAdditionalJS(); ?>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Documento sin t&iacute;tulo</title>
  6. </head>
  7.  
  8. <?php
  9. $form->GetInput('select_1');
  10. //echo "<br>";
  11. $form->GetInput('select_2');
  12. //echo "<br>";
  13. $form->GetInput('select_3');
  14. ?>
  15. </body>
  16. </html>