• Resolved raff25c

    (@raff25c)


    Hi! I cant find where i can set the choices on dropdown as value also. It always giving me a value of numbers on each choices i add on dropdown field

    example:
    <option value=”0″>City 1</option><
    option value=”1″>City 2</option>
    <option value=”2″>City 3</option></select>

    i want this:
    <option value=”City 1″>City 1</option><
    option value=”City 2″>City 2</option>
    <option value=”City 3″>City 3</option></select>

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @raff25c

    You need a custom code. Here’s an example for the field key cities:

    function um_custom_cities_options(){
    
        return $arr_custom_options = [
            "City 1",
            "City 2"
        ];
    
    }
    
    add_filter("um_checkbox_field_options_cities","um_checkbox_field_optionscities"); 
    function um_checkbox_field_options_cities( $options ){
    
        $options = um_custom_cities_options();
    
        return $options;
    }
    
    add_filter("um_user_edit_profile_fields","um_custom_edit_profile_fields", 10, 2 );
    function um_custom_edit_profile_fields( $custom_fields, $args ){
    
        $custom_fields["cities"]['options'] =  um_custom_cities_options();
    
        return $custom_fields;
    }
    
    add_filter("um_get_field__cities","um_get_field__cities");
    function um_get_field__cities( $options ){
       
        $options['options'] = um_custom_cities_options();
    
        return $options;
    }

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Dropdown Field Value’ is closed to new replies.