基本上我有一个表格。所以我有一个表单,可以在Web浏览器中显示我的文档。有一个带有Lotus Notes字段的字段,一些带有html标签的字段。
现在,我有一个命令按钮来编辑表单。我正在使用@Command([EditDocument])
进行编辑。因此,当我单击该按钮时,它将触发并使其可编辑。
与Web表单的常规Lotus Notes表单不同。我可以为网络中的Lotus Notes字段启用编辑功能,并禁用编辑功能,但不能为input标签启用编辑功能。 我尝试使用JavaScript通过onclick按钮隐藏,但我使用的是Lotus Notes按钮而不是html按钮。
HTML输入
<div class="form-group" id="date-container">
<span class="group-read"><Computed Value></span>
<input type="text" class="form-control group-edit" id="P-AssignDate" name="PAssignDate" autocomplete="off" value="<Computed Value>">
</div>
JavaScript
$(document).ready(function() {
$('#btn-edit').click(function() {
$('.group-edit').css('display','inline-block');
$('.group-read').css('display','none');
});
});
任何人都知道当表单不在编辑模式时如何隐藏输入按钮,它只显示值,而当表单处于编辑模式时,取消隐藏输入。
答案 0 :(得分:1)
也许您也可以在ready函数中检查URL。文档进入编辑模式后,网址应更改为?editDocument。
您还可以创建一个计算字段,如果正在编辑文档,该字段的值将为一个值,并在ready函数期间查询该字段...
答案 1 :(得分:0)
我只是将输入字段与div交换(当我想再次进入编辑模式时,反之亦然)。 这是两个按钮的代码,一个用于将所有具有数据属性dominofield的输入字段都转换为div,另一个用于将这些div还原为输入字段:
// Bind function to Read Only button
$('#btnReadOnly').click( function() {
// Get all input fields used for Domino
var inputs = $('[data-dominofield]');
// Process each field
inputs.each( function() {
// Build new DIV element
var input = $(this);
var div = '<div class="fieldReadOnly" ';
div += 'data-dominofield="'+input.data('dominofield')+'" ';
div += 'id="'+input.attr('id')+'">';
div += input.val() + '</div>';
// Insert ther new div element in front of input field
input.before(div);
// Remove input field
input.remove();
});
});
// Bind function to Edit button
$('#btnEdit').click( function() {
// Get all input fields used for Domino
var divs = $('[data-dominofield]');
// Process each field
divs.each( function() {
// Build new INPUT element
var div = $(this);
var input = '<input type="text" class="form-control" ';
input += 'data-dominofield="'+div.data('dominofield')+'" ';
input += 'value="'+div.html()+'" ';
input += 'id="'+div.attr('id')+'">';
// Insert ther new input field in front of existing div
div.before(input);
// Remove div element
div.remove();
});
});