Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Sunday, October 18, 2026
About Us
O nás
Magazine
Magazín
Open Source
Otvorený softvér
CVS
CVS
Services
Služby
Index  »  Projects  »  phpMyEdit  »  Forum  »  Adding labels for checkboxes from lookup table

phpMyEdit General     Adding labels for checkboxes from lookup table
Post new topic   Reply to topic    
 
webpaul     Joined: 08 Feb 2011   Posts: 6  
Post Posted: 2011-02-17 00:26
Back to top  Reply with quote     

Hi.
Great product.
I was trying to add labels for checkboxes or radio buttons from special lookup table. Like instead of: 'values' => array('Package', 'Forms only', 'Notes'), put something like that: 'values' => array($val[0], $val[1], $val[2]),

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2011-02-18 00:22
Back to top  Reply with quote     

First thought is that $val would need to be defined somewhere, like atop the script:

Code:
$val = array('apples', 'bananas', 'oranges');


then in the field array simply

Code:
'values' => $val,


 
webpaul     Joined: 08 Feb 2011   Posts: 6  
Post Posted: 2011-02-18 12:29
Back to top  Reply with quote     

Yeah, thanks, but how to use a separate lookup table for values? Is there good documentation for checkboxes and radio buttons? I couldn't find any

 
Davey     Joined: 31 Mar 2011   Posts: 16777215  
Post Posted: 2011-03-31 15:17
Back to top  Reply with quote     

webpaul,

This is not exactly what you wanted, but I've just managed to get the following to pull a Drop-Down list of values from a second lookup table...

Code:

$opts['fdd']['sku'] = array(
  'name'              => 'SKU',
  'select'            => 'D',
  'options|CDVL'     => 'CDRVL',      // adding |<opts> limits the options setting to only the specified operations (CDV)
  'sort'              => true,
  'values|A'          => array(
     'table'          => 'sku_groups',
     'orderby'       => 'grp ASC',
     'column'         => 'grp',
     'description'       => array('columns' => array('grp','next_id')), // these column fields get concatenated to provide the actual values listed
  )
);


I have a second table named 'sku_groups', with a 'grp' column and a 'next_id' column. When I Add a new item, the above creates a Drop-Down list containing all 'grp'+'next_id' values to allow me to choose the appropriate group for the item (something like 'ZZ42').

Because of the |A option setting on 'values', it only shows the dropdown on Add page. On other pages it shows it as a read-only textbox.

 
Davey     Joined: 31 Mar 2011   Posts: 16777215  
Post Posted: 2011-03-31 16:25
Back to top  Reply with quote     

webpaul,

This is not exactly what you wanted, but I've just managed to get the following to pull a Drop-Down list of values from a second lookup table...

Code:

$opts['fdd']['sku'] = array(
  'name'              => 'SKU',
  'select'            => 'D',
  'options|CDVL'     => 'CDRVL',      // adding |<opts> limits the options setting to only the specified operations (CDV)
  'sort'              => true,
  'values|A'          => array(
     'table'          => 'sku_groups',
     'orderby'       => 'grp ASC',
     'column'         => 'grp',
     'description'       => array('columns' => array('grp','next_id')), // these column fields get concatenated to provide the actual values listed
  )
);


I have a second table named 'sku_groups', with a 'grp' column and a 'next_id' column. When I Add a new item, the above creates a Drop-Down list containing all 'grp'+'next_id' values to allow me to choose the appropriate group for the item (something like 'ZZ42').

Because of the |A option setting on 'values', it only shows the dropdown on Add page. On other pages it shows it as a read-only textbox.

 
Davey     Joined: 31 Mar 2011   Posts: 16777215  
Post Posted: 2011-03-31 16:42
Back to top  Reply with quote     

webpaul,

This is not exactly what you wanted, but I've just managed to get the following to pull a Drop-Down list of values from a second lookup table...

Code:

$opts['fdd']['sku'] = array(
  'name'              => 'SKU',
  'select'            => 'D',
  'options|CDVL'     => 'CDRVL',      // adding |<opts> limits the options setting to only the specified operations (CDV)
  'sort'              => true,
  'values|A'          => array(
     'table'          => 'sku_groups',
     'orderby'       => 'grp ASC',
     'column'         => 'grp',
     'description'       => array('columns' => array('grp','next_id')), // these column fields get concatenated to provide the actual values listed
  )
);


I have a second table named 'sku_groups', with a 'grp' column and a 'next_id' column. When I Add a new item, the above creates a Drop-Down list containing all 'grp'+'next_id' values to allow me to choose the appropriate group for the item (something like 'ZZ42').

Because of the |A option setting on 'values', it only shows the dropdown on Add page. On other pages it shows it as a read-only textbox.

 
Davey     Joined: 31 Mar 2011   Posts: 16777215  
Post Posted: 2011-03-31 18:08
Back to top  Reply with quote     

webpaul,

This is not exactly what you wanted, but I've just managed to get the following to pull a Drop-Down list of values from a second lookup table...

Code:

$opts['fdd']['sku'] = array(
  'name'              => 'SKU',
  'select'            => 'D',
  'options|CDVL'     => 'CDRVL',      // adding |<opts> limits the options setting to only the specified operations (CDV)
  'sort'              => true,
  'values|A'          => array(
     'table'          => 'sku_groups',
     'orderby'       => 'grp ASC',
     'column'         => 'grp',
     'description'       => array('columns' => array('grp','next_id')), // these column fields get concatenated to provide the actual values listed
  )
);


I have a second table named 'sku_groups', with a 'grp' column and a 'next_id' column. When I Add a new item, the above creates a Drop-Down list containing all 'grp'+'next_id' values to allow me to choose the appropriate group for the item (something like 'ZZ42').

Because of the |A option setting on 'values', it only shows the dropdown on Add page. On other pages it shows it as a read-only textbox.

 
Davey     Joined: 31 Mar 2011   Posts: 16777215  
Post Posted: 2011-03-31 18:12
Back to top  Reply with quote     

webpaul,

This is not exactly what you wanted, but I've just managed to get the following to pull a Drop-Down list of values from a second lookup table...

Code:

$opts['fdd']['sku'] = array(
  'name'              => 'SKU',
  'select'            => 'D',
  'options|CDVL'     => 'CDRVL',      // adding |<opts> limits the options setting to only the specified operations (CDV)
  'sort'              => true,
  'values|A'          => array(
     'table'          => 'sku_groups',
     'orderby'       => 'grp ASC',
     'column'         => 'grp',
     'description'       => array('columns' => array('grp','next_id')), // these column fields get concatenated to provide the actual values listed
  )
);


I have a second table named 'sku_groups', with a 'grp' column and a 'next_id' column. When I Add a new item, the above creates a Drop-Down list containing all 'grp'+'next_id' values to allow me to choose the appropriate group for the item (something like 'ZZ42').

Because of the |A option setting on 'values', it only shows the dropdown on Add page. On other pages it shows it as a read-only textbox.

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Odkazový formulár · Application form · Prihláška
Report bug on PLATON.SK website · Upozorniť na chybu na PLATON.SK webstránke · Terms of use · Podmienky použitia · Privacy policy · Ochrana osobných údajov