选择列表中的复选框

时间:2013-08-19 19:03:53

标签: html list select checkbox xquery

如何在选择列表中设置复选框?该列表由一些xquery代码生成,使其更复杂一些。我在努力弄清楚如何在这里使用“输入”标签。

{if( $workcount > 1 )
then
<form name="bentform" action="{$g:blakeroot}archive/comparison.xq" onSubmit="return mySubmit()" target="comparison">
<input name="selection" type="submit" value="Compare" onClick="document.bentform.target='BentWin'"/>
<br/><br/>  
<select name="copies" multiple="multiple" size="3" >
<option selected="yes" value="all">All Copies and *Versions from Other Works*</option>
{for $copies in collection($g:collection)/bad[starts-with(@id , $workid)]/@id
let $bad := collection($g:collection)/bad[@id = $copies]
let $copyversion := string($bad/@copy), 
  $comporder := $bad[@id = $copies]//compdate[1]/@value, 
  $printorder :=$bad[@id = $copies]//printdate[1]/@value, 
  $printdate := $bad[@id = $copies]//printdate[1]/@value,
  $repository := $bad//repository/institution/text(),
  $repcount := count($repository)
 order by ($bad//compdate)[1]/@value, ($bad//printdate)[1]/@value, g:copydesignation($copies)
return 
if ($copies != $copyid)
then
<option value="{$copies}"><striptags>{if(exists($copyversion))then <wrap>{$copyversion}, </wrap>else ""} {string(substring-before( $printdate, '.' ))} ({if($repcount = 1) then $repository else <wrap>Multiple ({$repcount}) Institutions</wrap> })</striptags></option>
else if ( $compwith != "" ) then 
<p>If this worked, I'd be comparing this plate with {$compwith}</p>
else "..."
}

1 个答案:

答案 0 :(得分:0)

    {if( $workcount > 1 )
    then
    <form name="bentform" action="{$g:blakeroot}archive/comparison.xq" onSubmit="return mySubmit()" target="comparison">
    <input name="selection" type="submit" value="Compare" onClick="document.bentform.target='BentWin'"/>
    <br/><br/>  
    <input type="checkbox" name="copies[]" value="all" id="all" /><label for="all">All Copies and *Versions from Other Works*</label>
    {for $copies in collection($g:collection)/bad[starts-with(@id , $workid)]/@id
    let $bad := collection($g:collection)/bad[@id = $copies]
    let $copyversion := string($bad/@copy), 
      $comporder := $bad[@id = $copies]//compdate[1]/@value, 
      $printorder :=$bad[@id = $copies]//printdate[1]/@value, 
      $printdate := $bad[@id = $copies]//printdate[1]/@value,
      $repository := $bad//repository/institution/text(),
      $repcount := count($repository)
     order by ($bad//compdate)[1]/@value, ($bad//printdate)[1]/@value, g:copydesignation($copies)
    return 
    if ($copies != $copyid)
    then
    <input type="checkbox" name="copies[]" value="{$copies}" id="{$copies}" /><label for="{$copies}"><striptags>{if(exists($copyversion))then <wrap>{$copyversion}, </wrap>else ""} {string(substring-before( $printdate, '.' ))} ({if($repcount = 1) then $repository else <wrap>Multiple ({$repcount}) Institutions</wrap> })</striptags></label>
    else if ( $compwith != "" ) then 
    <p>If this worked, I'd be comparing this plate with {$compwith}</p>
    else "..."
    }