2009-06-17

Live Cycle Designer下text object和text field object的区别

当把表单中的数据导出成XML文件时,text object的数据不会出现在XML文件中,而text field object的数据会出现在XML文件中。

可以设置tab order忽略text object,但不能跳过text field object,尽管它的属性设置为invisible或hidden。

2009-06-16

清除radionbutton group的选择状态

通过脚本来清除radiobutton group 的选择状态不能通过设置其值为null,而必须设置其值为空,如

F.P.radioButtonGroup.rawValue = "";  而不是F.P.radioButtonGroup.rawValue = null;

javascript中的比较

如果把一个string和一个number相比较,javascript会自动试着将string转换为number,所以 "1.010" == 1.01 表达式返回true。

空和空格会被转换为数字0,所以不管是"" == 0,还是"  " == 0 都会返回true。

这也与使用的比较操作符 == 有关。更严格的比较使用 ===,参看javascript reference

2009-06-14

又长一颗痣

早上起床洗脸突然发现右脸上有多了一颗黑痣。在此之前右脸上已经长了两颗黑痣,不过没留意过是什么时候钻出来的。这次这颗竟然在一夜之间就冒出来了。

2009-06-10

删除一对XML标签内的文字2

LiveCycle Designer不提供一次删除所有的javascript代码,要清空多个xdp文件内的脚本得使用正则表达式来将<script contentType="application/x-javascript">和</script>标签之内的文字替换为空,也就是删除<script contentType="application/x-javascript">和</script>标签内的脚本。

我的尝试:
:%s/\(<script \a*="\a*\/x-javascript">\)\([^<]*\)\(<\/script>\)/\1\3/

或者
:%s#\(<script contentType="application/x-javascript">\)[^<]*\(</script>\)#\1\2#

用sed来处理:
sed -rn 's#(<script contentType="application/x-javascript">)[^<]*(</script>)#\1\2#g;p' myfile.xdp

如果脚本有多行,需要处理换行的情况:
%s#\(<script contentType="application/x-javascript">\)\([^<]*\n\)*[^<]*\(</script>\)#\1\3#g

或者用awk来处理换行的情况:

awk -v RS="<script contentType=\"application/x-javascript\">" 'NR!=1{gsub("^[^<]*</script>","</script>")}{printf NR==1?$0:RS""$0}'  myfile.xdp

Update: (2009-06-24 )

要干净删除已有的脚本代码,仅仅删除<script>标签内的代码还不够。这样会留下很多空的不包含脚本的event标签,当再次添加脚本文件时,如果新生成的event标签连同script标签在原来那个标签之后,那么代码将不会在design view下显示出来,而只在XML source中显示出来,在执行时,代码仍会被执行。也就是说,一个不包含任何代码代码的form的xml source里面应该有不会有event标签出现。

2009-06-03

xdp文件变大问题

今天留意到我这几天正编辑的xdp文件已经到了8MB了,原来不过仅仅几百KB。这又让我想到经常代码写进去后在design view下看不到,只有在xml source界面下才能看到,并且是重复的。

网上google的结果是,这是Livecycle Designer ES 8.2的一个Bug造成的。
A bug introduced with LiveCycle Designer ES Update 1 (8.2) is now fixed in LiveCycle service pack 2 and the Acrobat 9.1 update. The bug causes a processing instruction ex. <?templateDesigner StyleID aped3?> to get copied repeatedly while working with the form. This can lead to extremely large file sizes and sometime causes crashes. The fix removes duplicate StyleID's found in existing forms and prevents them from being created.
http://blogs.adobe.com/livecycle/2009/03/post.html