@ Steve
First, add the following to your theme’s custom CSS area. It’ll make the drop down more visible:
#cn-slim-plus select#cn-cn-region {
min-width: 250px;
}
The “Select a State” might not be displaying for you because of tweaks I’ve made to my dev version to make it work.
After another test, if you use the following code … it”l at least show “Select an option“. And when I release version 8.1.6, it should automatically say “*Select a State”:
function cn_state_select() {
global $wpdb;
$sql = 'SELECT state FROM ' . CN_ENTRY_ADDRESS_TABLE . ' GROUP BY state';
$result = $wpdb->get_col( $sql );
$keys = array_map( 'urlencode', $result );
$values = array_map( 'esc_attr', $result );
$states = array_combine( $keys, $values );
cnHTML::select( array( 'id' => 'cn-region', 'name' => 'cn-region', 'options' => $states, 'enhanced' => TRUE, 'default' => 'Select a State' ) );
}
add_action( 'cn_action_list_before-slim-plus', 'cn_state_select', 98 );
function cn_add_submit_button( $atts, $results ) {
cnTemplatePart::submit( array( 'return' => FALSE ) );
}
add_action( 'cn_action_list_before-slim-plus', 'cn_add_submit_button', 99, 2 );
function cn_disable_category_select( $atts ) {
$atts['enable_category_select'] = FALSE;
return $atts;
}
add_filter( 'cn_list_atts-slim-plus', 'cn_disable_category_select', 9 );
The 99, filter your results by it. Four entries have the state set as 99. The drop down will show exactly what what was entered in the db. It will not validate the results. Future versions will standardize this a bit by making the state and country fields autocomplete drop downs (that’s why there’re option in the settings to set the default country and region/state). These drop downs will not force a value to be used (letting any value to be entered) but since the selection will be shown it’ll be a strong encouragement to use the value in the drop down rather than a random value. I have to do it this way for backward compatibility because all sorts of stuff/variations have been entered into these fields and I have to make sure not to break that.
