Title: Select and Validations
Last modified: February 23, 2018

---

# Select and Validations

 *  [paolopiselli](https://wordpress.org/support/users/paolopiselli/)
 * (@paolopiselli)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/select-and-validations/)
 * Hello, in version 2.0.6 there seems to be some problems related to the Select
   value/label and related to DatePicker error messages:
    1) In the Cart, the field
   choosed from a select is showing the Value and not the Label; 2) In the frontend,
   if a DatePicker is required but not compiled, no error message is showing. Thanks
   in advance for this good plugin!

Viewing 1 replies (of 1 total)

 *  Thread Starter [paolopiselli](https://wordpress.org/support/users/paolopiselli/)
 * (@paolopiselli)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/select-and-validations/#post-10113298)
 * In the Cart page, you usually get the VALUE of the Select options: if you would
   prefere to get the LABEL, you can apply this little modification to the file \
   wp-content\plugins\wc-fields-factory\includes\wcff-cart-data.php
 * Substitute around line 259 with this if:
 * /* To visualize the Label instead of the Value for the Select options */
    if (
   isset($_field[“choices”])) { $this->wccpf_items[] = array(“name” => $cif_data[“
   field_key”], “value” => find_label($cif_data[“field_val”], $_field[“choices”]));}
   else { $this->wccpf_items[] = array(“name” => $cif_data[“field_key”], “value”
   => $cif_data[“field_val”]); }
 * Add this little function at the end of the file:
 * function find_label($_val, $_choices) {
    $_choi = explode(“;”,$_choices); foreach(
   $_choi as $_couple) { $_temp = explode(“|”,$_couple); if ( $_temp[0] == $_val){
   return $_temp[1]; } } return $_val; }

Viewing 1 replies (of 1 total)

The topic ‘Select and Validations’ is closed to new replies.

 * ![](https://ps.w.org/wc-fields-factory/assets/icon-128x128.jpg?rev=2738843)
 * [WC Fields Factory](https://wordpress.org/plugins/wc-fields-factory/)
 * [Support Threads](https://wordpress.org/support/plugin/wc-fields-factory/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-fields-factory/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-fields-factory/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-fields-factory/reviews/)

## Tags

 * [datepicker](https://wordpress.org/support/topic-tag/datepicker/)
 * [select](https://wordpress.org/support/topic-tag/select/)

 * 1 reply
 * 1 participant
 * Last reply from: [paolopiselli](https://wordpress.org/support/users/paolopiselli/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/select-and-validations/#post-10113298)
 * Status: not resolved