Solution:
add_action('admin_init', 'theme_options_init');
add_action('admin_menu', 'theme_options_add_page');
function theme_options_init() {
register_setting('theme_options', 'mytheme_theme_options', 'theme_options_validate');
}
function theme_options_add_page() {
$page = add_theme_page(__('Theme Options', 'mytheme' ), __('Theme Options', 'mytheme'), 'edit_theme_options', 'theme_options', 'theme_options_do_page');
add_action('admin_print_styles-'.$page, 'theme_options_js');
}
function theme_options_js() {
// whatever js you need...
wp_enqueue_script('jquery-ui-core');
}
function theme_options_validate($input) {
$input['sometextarea'] = wp_filter_post_kses($input['sometextarea']);
return $input;
}
function theme_options_do_page() {
if (!isset($_REQUEST['settings-updated'])) {
$_REQUEST['settings-updated'] = false;
}
?><div>
your theme options page
</div><?php
}