Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Utorok, 24. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  table joining value extraction plus "null" value

phpMyEdit Configuration     table joining value extraction plus "null" value
Odoslať novú tému   Odpovedať na tému    
 
pupkin     Založený: 24.03.2004   Príspevky: 3  
Príspevok Zaslal: 2004-03-24 18:13
Návrat hore  Odpovedať s citátom     

Hello,
I would like to have a drop-down driven from another table, but so that the first value in the drop-down be a blank value that would result into writing "null" for the field.
Kód:
$opts['fdd']['city1_id'] = array(
  'name'     => 'City',
  'select'   => 'T',
  'maxlen'   => 11,
  'required' => true,
  'sort'     => true,
  'values'   => array(
        'table'    => 'city',
      'column' => 'id',
      'description'=> array(
                  'columns'=>array(0=>'arrive', 1=>'city'),
                  'divs'=>array(0=>' ')
               ),
      'orderby'=>'-id'
  )
);

works nicely, but only produces values actually present in the table city, but does not allow me to write "null" or even '0' into 'city1_id'
Thank you very much if anyone knows how to deal with this

 
pupkin     Založený: 24.03.2004   Príspevky: 3  
Príspevok Zaslal: 2004-03-25 15:40
Návrat hore  Odpovedať s citátom     

actually, reading the documentation more attentively I've answered part of my question: how to add a value that is not one of the values in the dependent table. Done easily with 'values2' as described in http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.input-restrictions.html#AEN682
but my other question remains: how do I wirte "NULL" as a value. My code now looks like this
Kód:
$opts['fdd']['city3_id'] = array(
  'name'     => 'City',
  'select'   => 'T',
  'maxlen'   => 11,
  'sort'     => true,
  'default'  => null,
  'values'   => array(
        'table'    => 'city',
      'column' => 'id',
      'description'=> array(
                  'columns'=>array(0=>'arrive', 1=>'city'),
                  'divs'=>array(0=>' ')
               ),
      'orderby'=>'-id'
  ),
  'values2'   =>   array(
        null =>'-'
  ), 
  'options' => 'ACPVD'
);

which allows interpretation of fields that are already NULL as "-" in display modes, but still does not write "NULL", when I choose "-" from the drop-down, but writes "0" instead

 
pupkin     Založený: 24.03.2004   Príspevky: 3  
Príspevok Zaslal: 2004-03-25 18:27
Návrat hore  Odpovedať s citátom     

Should have read the manual!
second half of the answer as described in http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.fields.sql.html#AEN993
so the code now looks like this
Kód:
$opts['fdd']['city2_id'] = array(
  'name'     => 'City',
  'select'   => 'T',
  'maxlen'   => 11,
  'sort'     => true,
  'default'  => null,
  'values'   => array(
        'table'    => 'city',
      'column' => 'id',
      'description'=> array(
                  'columns'=>array(0=>'arrive', 1=>'city'),
                  'divs'=>array(0=>' ')
               ),
      'orderby'=>'-id'
  ),
  'values2'   =>   array(
        '0' =>'-'
  ), 
  'options' => 'ACPVD',
  'sqlw' =>   'IF($val_qas = "0", NULL, $val_qas)' 
);


 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov