Multiple select field, displaying not-selected values

More
11 years 9 months ago #34119 by brandonking
After upgrade to r1648, I have no clue how to change to display all elements in multipleselect.php.

I guess I need to change below codes.
Code:
// Create display of field $display = array(); $display_index = array(); for($n=0, $c=count($values); $n<$c; $n++) { $element = @$elements[ $values[$n] ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $pretext . $fe_display . $posttext; $display_index[] = $element->value; } }

As you also think that this would be nice feature and less code work for you, would you please be able to add this as core feature?

Backend setting parameter require:
1. show all elements Yes/No
2. pretext/posttext for non-selected elements

Best wishes,
Brandon

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #34581 by ggppdk
This is very interesting , very easy to add, so it will be in v2.0.1 or in v2.0.2

Will add to radio / checkbox / select / selectmulitple


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #34583 by brandonking
Wonderful, thank you very much and look forward to it.

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #34585 by ggppdk
Now that i think of it , it makes sense to add to radio image and checkbox image,

since with prefix/suffix for "unused values" we can add a CSS class that can be used to make the inner image appear disabled

e.g.
for prefix: <span class="fc_field_unsused_val">
for suffix: </span>

this CSS rule will make image appear disabled:
Code:
.fc_field_unsused_val img { opacity:0.4; filter:alpha(opacity=40); /* For IE8 and earlier */ }

Will add above as defaults too so that user will have a satisfactory result with little configuration

and for text we could have this default CSS rule
Code:
.fc_field_unsused_val { text-decoration: line-through; }


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #34587 by brandonking
My hero, That is pretty nice!!

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #34963 by brandonking
Installed r1657 but seems no implementation for this.
I have fegured it out for selectmultiple.php.

From:
Code:
Line 192 for($n=0, $c=count($values); $n<$c; $n++) { $element = @$elements[ $values[$n] ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $pretext . $fe_display . $posttext; $display_index[] = $element->value; } }

To:
Code:
if ($display_all){ for($m=0, $cc=count(@$elements); $m<$cc; $m++) { $check_val=0; for($n=0, $c=count($values); $n<$c; $n++) { if ($m == $values[$n]){ $element = @$elements[ $values[$n] ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $pretext . $fe_display . $posttext; $display_index[] = $element->value; $check_val=1; } } } if($check_val == 0){ $element = @$elements[ $m ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $ns_pretext . $fe_display . $ns_posttext; $display_index[] = $element->value; $check_val=1; } } } }else{ for($n=0, $c=count($values); $n<$c; $n++) { $element = @$elements[ $values[$n] ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $pretext . $fe_display . $posttext; $display_index[] = $element->value; } } }
Initailizing Variables:
Code:
$display_all = $field->parameters->get( 'display_all', 0 ) ; $ns_pretext = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'ns_pretext', '' ), 'ns_pretext' ); $ns_posttext = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'ns_posttext', '' ), 'ns_posttext' ); if($ns_pretext) { $ns_pretext = $remove_space ? $ns_pretext : $ns_pretext . ' '; } if($ns_posttext) { $ns_posttext = $remove_space ? $ns_posttext : ' ' . $ns_posttext; }

selectmultiple.xml
Code:
<field name="display_all" type="radio" default="0" label="FLEXI_DISPLY_ALL_ITEMS_MULTI_SELECT" description="FLEXI_DISPLY_ALL_ITEMS_MULTI_SELECT_DESC"> <option value="0">FLEXI_NO</option> <option value="1">FLEXI_YES</option> </field> <field name="ns_pretext" type="text" default="" label="FLEXI_FIELD_VALUE_PREFIX_TEXT_NONSELECTED" description="FLEXI_FIELD_VALUE_PREFIX_TEXT_NONSELECTED_DESC" /> <field name="ns_posttext" type="text" default="" label="FLEXI_FIELD_VALUE_SUFFIX_TEXT_NONSELECTED" description="FLEXI_FIELD_VALUE_SUFFIX_TEXT_NONSELECTED_DESC" />

It is working without any problem so please use these codes(Maybe some changes needed for better performance) if you don't mind.

Best wishes,
Brandon

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.380 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline