editor dependend with NULL option

editor dependend with NULL option

koniahinkoniahin Posts: 63Questions: 13Answers: 1

I got editor dependent working nicely with a list of country and region codes. I now realize that we don't always have the region name to select from the list. In that case we need to add a NULL or empty --select-- option as the first item in the select list. How do we do that?

    $regions = $db
        ->select( 'regions', ['regions.region_code as value', 'regions.region_name as label'], ['regions.country_code' => $_REQUEST['values']['roster.pob_country_code'], 'publish' => 'Yes'] )
        ->fetchAll();

    echo json_encode( [
        'options' => [
            'roster.pob_region_code' => $regions
        ]
    ] );
Sign In or Register to comment.