PDA

View Full Version : 自定义的checkbox如何才能有效???


xdw076
09-01-07, 04:55 PM
在视图中自定义的列为checkbox ,如
"[<input type=\"checkbox\" name=\"$$SelectDoc\" value=\""+@Text(@DocumentUniqueID)+"\">]"
但是在执行如删除操作时,却不能删除文件???

我怀疑是表单生成时的动作不对!<form name="_dominoform" action="***">
(我使用的是表单的内嵌视图)
由于没有选用"视图选定的页边距属性"所以在生成表单时没有自动生成action动作!!
不知道是不是这个原因,请大侠指教!!

如果是的话,应该如何写这个action???

sky0321
14-01-07, 04:54 PM
在内嵌视图的表单里加个复选框名字为$$SelectDoc,属性为隐藏,然后在删除操作里调用如下代理
Sub Initialize
On Error Goto er
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim item As notesitem
Dim doctodelete As notesdocument

Set db=session.currentdatabase
Set doc=session.documentcontext
Set item=doc.getfirstitem("$$SelectDoc")
destname = doc.getitemvalue("$$SelectDoc")(0)
Forall unid In item.values
If unid <> "" Then
Set doctodelete=db.getdocumentbyunid(unid)
If Not doctodelete Is Nothing Then
Call doctodelete.remove(True)
End If
End If
End Forall
Exit Sub
er:
Msgbox "error in agent shanchu in line :"+" "+Cstr(Erl())+" "+Error$
End Sub

xdw076
15-01-07, 01:24 PM
谢谢sky0321 兄:

我在表单中加入了一个<input name="$$SelectDoc" type="checkbox" value="">
delete热点调用了你所提供的代理,仍然不能删除!!

我的具体做法如下::
建立表单$$viewtemplate for ($all)
创建\嵌入元素\视图,取消"视图选定的页边距属性"
在视图中自定义的列为checkbox ,列公式为:
"[<input type=\"checkbox\" name=\"$$SelectDoc\" value=\""+@Text(@DocumentUniqueID)+"\">]"
表单中加入:<input name="$$SelectDoc" type="checkbox" value="">

建立热点delete,公式:@Command([ToolsRunMacro]; "delete")

创建代理delete,程序如sky0321提供

但是仍然没有删除.

xdw076
16-01-07, 04:57 PM
:L 上楼兄弟再帮忙看看!!!
谢谢!!

xdw076
17-01-07, 03:53 PM
原帖由 sky0321 于 2007-1-14 04:54 PM 发表
在内嵌视图的表单里加个复选框名字为$$SelectDoc,属性为隐藏,然后在删除操作里调用如下代理
Sub Initialize
On Error Goto er
Dim session As New notessession
Dim db As notesdatabase
Dim doc As n ...

这个只能删除当前文档吧!!!我想一次能删除多个所选的文档.应如何写啊?

sky0321
17-01-07, 05:17 PM
在内嵌视图的表单里加个复选框名字为$$SelectDoc,属性为隐藏,这个是lotus里的复选框域,
不是删除当前文档,删除的是你所选中的文档,要删除多个,把$$SelectDoc域允许多值,然后看懂代理的这段:
Set db=session.currentdatabase
Set doc=session.documentcontext
Set item=doc.getfirstitem("$$SelectDoc")

Forall unid In item.values
If unid <> "" Then
Set doctodelete=db.getdocumentbyunid(unid)
If Not doctodelete Is Nothing Then
Call doctodelete.remove(True)
End If
End If
End Forall

注:$$SelectDoc记录的是你在复选框前打勾的所有文档ID.
说的应该很清楚了

sky0321
18-01-07, 02:34 PM
可以删除多个所选文档的

xdw076
19-01-07, 10:39 AM
相当的郁闷!!!!!!!!!!!!!!!!!!:L :L :mad: :mad: :mad: :mad:


一个文件都不能删除,数据库已经选择了"允许软删除"
复选框本身就是允许多值的

sky0321
19-01-07, 02:18 PM
代理的属性要选择代理列表选择,目标无.在后台加msgbox 把unid 打出来看看.

xdw076
19-01-07, 03:37 PM
代理确如你说的那样设置的!!!!


后台加msgbox 把unid 打出来看看.
==========================================
是指" Msgbox "error in agent shanchu in line :"+" "+Cstr(Erl())+" "+Error$"吗????

xdw076
19-01-07, 04:17 PM
能否把生成网页的源文件给我看看???

就是那个浏览器/查看/源文件 保存成文本文件.

我想看看里面的<form>是否一样!!!

sky0321
19-01-07, 05:41 PM
Forall unid In item.values
If unid <> "" Then
msgbox unid '加这句
Set doctodelete=db.getdocumentbyunid(unid)
If Not doctodelete Is Nothing Then
Call doctodelete.remove(True)
End If
End If
End Forall
我这是可以的,我是R654的环境,

sky0321
19-01-07, 05:58 PM
你要的源文件
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

<script language="JavaScript" type="text/javascript">
<!--
document._domino_target = "_self";
function _doClick(v, o, t, h) {
var form = document._oppo;
if (form.onsubmit) {
var retVal = form.onsubmit();
if (typeof retVal == "boolean" && retVal == false)
return false;
}
var target = document._domino_target;
if (o.href != null) {
if (o.target != null)
target = o.target;
} else {
if (t != null)
target = t;
}
form.target = target;
form.__Click.value = v;
if (h != null)
form.action += h;
form.submit();
return false;
}
// -->
</script>
</head>
<body text="#000000" bgcolor="#FFFFFF">

<form method="post" action="/s.nsf/oppo?OpenForm&amp;Seq=1" name="_oppo">
<input type="hidden" name="__Click" value="0">
<input type="button" value="dele" onclick="return _doClick('482571ED0034E3D7.7850b01e7fd0e31748257235001193a2/$Body/0.70', this, null)">
<input type="checkbox" name="Delete" value="" checked>
<input type="checkbox" name="$$SelectDoc" value="" checked><br>

<table border="0" cellpadding="2" cellspacing="0">
<tr>
<th nowrap align="left">sdsdf</font></th>

<th></th>

<th nowrap align="left">saad</font></th>
</tr>

<tr valign="top"><td nowrap><img src="/icons/ecblank.gif" border="0" height="1" width="16" alt=""><input type=checkbox name=Delete value=4B9B7629648E736048257263003116D5></td></td><td nowrap><a href="/s.nsf/3b0dec83da25910748257234002564c5/4b9b7629648e736048257263003116d5?OpenDocument">1</a></td><td nowrap></td></tr>

<tr valign="top"><td nowrap><img src="/icons/ecblank.gif" border="0" height="1" width="16" alt=""><input type=checkbox name=Delete value=F6D70FA38C0B76C8482572680036C3CC></td></td><td nowrap><a href="/s.nsf/3b0dec83da25910748257234002564c5/f6d70fa38c0b76c8482572680036c3cc?OpenDocument">2</a></td><td nowrap></td></tr>

<tr valign="top"><td nowrap><img src="/icons/ecblank.gif" border="0" height="1" width="16" alt=""><input type=checkbox name=Delete value=1CB0880BDF36AF89482572680036C796></td></td><td nowrap><a href="/s.nsf/3b0dec83da25910748257234002564c5/1cb0880bdf36af89482572680036c796?OpenDocument">3</a></td><td nowrap></td></tr>

<tr valign="top"><td nowrap><img src="/icons/ecblank.gif" border="0" height="1" width="16" alt=""><input type=checkbox name=Delete value=5C018CE87D2F2498482572680036CB5B></td></td><td nowrap><a href="/s.nsf/3b0dec83da25910748257234002564c5/5c018ce87d2f2498482572680036cb5b?OpenDocument">4</a></td><td nowrap></td></tr>
</table>
</form>
</body>
</html>

xdw076
22-01-07, 12:57 PM
非常感谢sky0321 兄!!!

已经成功!!!参看你的源码后,把复选框$$SelectDoc放在表单的上头可可以了!!而我原来放在底部的却不行!!!并且只能在样式里设置不可见,不能在段落隐藏里设置,否则不起作用!!

我的版本是7.01的!!

再问一问::所放置的复选框默认是选中的,如何设置成不选状态?????

谢谢!11111111111