| 
Welcome, Guest

required select list problem
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: required select list problem

Re:required select list problem 2 years, 8 months ago #101383

  • Posts:
  • Karma:
I'm trying to find a way to create a drop down list of US states and it led me to this thread... I am to understand the list has to be created manually? Is there a bug that prevents this method for creating such a drop down exist?

I have purchased a license for CB Subs and the list is needed for registration.

Thank you!

Post edited by: supplymetal, at: 2009/06/08 12:22
The topic has been locked.

Re:required select list problem 2 years, 8 months ago #101464

  • Posts:
  • Karma:
supplymetal wrote:
I'm trying to find a way to create a drop down list of US states and it led me to this thread... I am to understand the list has to be created manually? Is there a bug that prevents this method for creating such a drop down exist?

I have purchased a license for CB Subs and the list is needed for registration.

Thank you!

Post edited by: supplymetal, at: 2009/06/08 12:22


You can follow example of this article:

www.joomlapolis.com/content/view/208/37/

and make it work for states case.
The topic has been locked.

Re:required select list problem 2 years, 1 month ago #120829

  • Posts:
  • Karma:
The original issue is fixed for upcoming CB 1.2.2.

Here the fix in diff-style:

+++ administrator/components/com_comprofiler/comprofiler.class.php
@@ -335,11 +335,11 @@
function selectList( &$arr, $tag_name, $tag_attribs, $key, $text, $selected, $required = 0, $htmlspecialcharText = true ) {
reset( $arr );
$id_name = moscomprofilerHTML::htmlId( $tag_name );
$html = "\n"
. '<select name="' . htmlspecialchars( $tag_name ) . '" id="' . htmlspecialchars( $id_name ) . '" ' . $tag_attribs . '>';
- $addBlank = ( ( ! $required ) && ! ( isset( $arr[0] ) && $arr[0]->$key == '' ) );
+ $addBlank = ( ( ( ! $required ) || ( is_array( $selected ) ? ( count( $selected ) == 0 ) : ( $selected == '' ) ) ) && ! ( isset( $arr[0] ) && $arr[0]->$key == '' ) );
if ( $addBlank ) {
$html .= "\n\t<option value=\"\"> </option>";
}
 
 
+++ administrator/components/com_comprofiler/plugin.class.php
@@ -1558,11 +1558,15 @@
$value->text = ( $reason == 'search' ? ( $noneValue ? _UE_NONE : _UE_NO_PREFERENCE ) : _UE_NO_INDICATION );
return $value;
}
function _explodeCBvaluesToObj( $value ) {
if ( ! is_array( $value ) ) {
- $value = explode( '|*|', $value );
+ if ( ( $value === '' ) || is_null( $value ) ) {
+ $value = array();
+ } else {
+ $value = explode( '|*|', $value );
+ }
}
$objArr = array();
foreach( $value as $k => $kv ) {
$objArr[$k]->value = $kv;
$objArr[$k]->text = $kv;
 


Edit: (fix format posted is unified diff: remove lines with - and replace by lines with + at begin).

Post edited by: beat, at: 2010/01/05 16:29
Beat
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly
CB links: Subscribe to CB documentation - Our templates - Paid Subscriptions - Get Hosting - Our Forge - Incubator
Visit my CB Profile - Send me a Private Message (PM)
--
help us spend more time coding by helping others in this forum, many thanks
The topic has been locked.
  • Page:
  • 1
  • 2
Time to create page: 0.79 seconds