For use-cases where a page should not be allowed to get saved without a folder being selected, following solution should help -

1. Add the following editable region to the template in question.
Code: Select all
<cms:editable type='hidden' name='dummy' validator='my_check_folders' order='-1' >1</cms:editable>

As can be seen, it is a dummy field with no purpose other than to trigger the validation routine in point 2 below)

2. Add the following validator function in 'couch/addons/kfunctions.php' file (if the file does not exist, rename the 'kfunctions.example.php' to 'kfunctions.php') -
Code: Select all
// validator for core folders dropdown (set on a dummy hidden field)
function my_check_folders( $field, $args ){
    $f = $field->page->_fields['k_page_folder_id'];
    $fid = $f->get_data();
    if( $fid=='-1' ){
        $f->err_msg='Please select a folder'; // set error on folder field
        return KFuncs::raise_error( '' ); // returning an error to fail page save

And now if no folder is selected while saving, the page should throw an error.
Hope this helps,