我需要在drupal 7垂直标签中使用此功能,有人可以帮我吗?
$("#tabs").tabs({
activate:function(event,ui){
var curRadio = $("input[type=\'radio\']:checked");
curRadio.prop(\'checked\', false);
}
});
答案 0 :(得分:0)
我用这种方式解决了我的问题:
drupal_add_css('http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css', 'external');
drupal_add_js('http://code.jquery.com/jquery-1.10.2.js', 'external');
drupal_add_js('http://code.jquery.com/ui/1.11.4/jquery-ui.js', 'external');
$years = db_query("SELECT DISTINCT year FROM {syllabus_main_course}");
$form = array();
$x = "";
$options = array();
foreach ($years as $year) {
global $user;
$results = db_query("SELECT * FROM {syllabus_main_course} WHERE {coordinator}='" . $user -> uid . "' AND {year}=" . $year -> year . " AND ({status}='0' OR {status}='2')");
$x .= "<li><a href='#" . $year -> year . "'>" . $year -> year . "</a></li>";
foreach ($results as $result) {
if ($result -> status == 0) {
$id = $result -> id;
$name = $result -> name . " *Fill";
$options[$id] = $name;
} else if ($result -> status == 2) {
$id = $result -> id;
$name = $result -> name . " *Declined";
$options[$id] = $name;
}
}
}
$form['radio'] = array(
'#type' => 'radios',
'#options' => $options,
'#prefix' => '<div id="tabs">
<ul>' . $x . '</ul>',
'#suffix' => '</div><script> $(function() { $("#tabs").tabs(); }); </script>',
);
$years = db_query("SELECT DISTINCT year FROM {syllabus_main_course}");
foreach ($years as $year) {
global $user;
$results = db_query("SELECT * FROM {syllabus_main_course} WHERE {coordinator}='" . $user -> uid . "' AND {year}=" . $year -> year . " AND ({status}='0' OR {status}='2')");
$i=1;
foreach ($results as $result) {
if ($results->rowCount() == 1) {
$form['radio'][$result -> id] = array(
'#prefix' => '<div id="' . $year -> year . '">',
'#suffix' => '</div>'
);
} else {
if ($i == 1) {
$form['radio'][$result -> id] = array(
'#prefix' => '<div id="' . $year -> year . '">'
);
}
if ($i == $results->rowCount()) {
$form['radio'][$result -> id] = array(
'#suffix' => '</div>'
);
}
}
$i++;
}
}