Output selectlist

12 years 10 months ago - 12 years 10 months ago #166486 by some1new
Output selectlist was created by some1new
I made an plugin to output some values via selectlist as a field.

case "htmledit" should show the select list.

I get a correct sql-statement with
$allValues		=	$_CB_database->loadObjectList();

using print_r($allValues) gives an area as objectlist
"Array ( [0] => stdClass Object ( [company] => Mosaix, Inc. ) [1] => stdClass Object ( [company] => Aixtron ) [2] => stdClass Object ( [company] => Crit.Caixacorp ) )

The Correct number of lines is within the selectbox but there are no values at all in it, just blank box. I´ve searched for hours to find the error but have no more idea.

Any hints?

Please Log in to join the conversation.

12 years 10 months ago - 12 years 10 months ago #166512 by some1new
Replied by some1new on topic Re: Output selectlist
OK,

so far I found out that I need at least 'text' & 'value' to define in area to show the selectbox.

My Area now looks something like:

Array ( [0] => stdClass Object ( [value] => Aixtron [text] => Aixtron [id] => 0 ) [1] => stdClass Object ( [value] => Crit.Caixacorp [text] => Crit.Caixacorp [id] => 1 ) [2] => stdClass Object ( [value] => Mosaix, Inc. [text] => Mosaix, Inc. [id] => 2 ) )

When I select an item it is not stored into the defined value within #__comprofiler.

How can I mak sure the value is going to be stored?
Do I need another function within the plugin?

Please Log in to join the conversation.

12 years 10 months ago #166590 by krileon
Replied by krileon on topic Re: Output selectlist
Don't understand what you're trying to do. Are you developing a new fieldtype plugin? Typically you'd pass the allValues variable to the selectlist HTML function to render the list. If creating a fieldtype function you'll need a store function; please see core.php on how to create fieldtype classes.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 10 months ago - 12 years 10 months ago #166597 by some1new
Replied by some1new on topic Re: Output selectlist
Thanks for reply.

Yes, trying to get selectlist values from sql table to have another dropdownselect field plugin.
$output =  $this->_fieldEditToHtml( $field, $user, $reason, 'input', 'select', $value,'', $allValues);

is used for output, what´s the difference to
$output = moscomprofilerHTML::selectList( $allValues, $control_name ? $control_name .'['. $value .'][]' : $value, ( $multiple ? 'size="6" multiple="multiple"' : null ), 'value', 'text', $valAsObj, 0, true );
?

Can I find out anywhere the handling and description of the variablesused in the functions?

Please Log in to join the conversation.

12 years 10 months ago - 12 years 10 months ago #166726 by krileon
Replied by krileon on topic Re: Output selectlist
I suggest you review the drop-down select class for drop-down select fields in cb.core.php. You basically can copy that exact class, rename it to fit your plugin, and you've a new fieldtype class. All you'd need to do is pass it your own values list. CB has full phpdocs; if you need function descriptions just navigate to the function and it'll describe its variables.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.285 seconds