Feb 2012
Title:
How to create form field with text area as read only.
IBPM Version: This is valid for QuickForm in all IBPM version.
Problem Description:
Need to know the way by which we can create the “textarea” field as “ReadOnly” and how to display the value of textarea in “multiple lines”.
In order to resolve this issue, we need to follow the following two steps.
1st Step:- To make textarea read only for end user, we need to use the following QuickForm expression to access the UDA that stores the value of textarea.
<tr class="oddrow">
<td class="prompt">Approver's Comment READONLY</td>
<td> <textarea name="UDA_Name" id=" UDA_Name" rows="10" cols="40” readonly="readonly"> {{Field Variable_Name}} </textarea> </td>
</tr>
Where UDA_Name = name of text area
Variable_Name = value of the text area
Note: A text area id needs to be added explicitly.
2nd Step:- While writing comment, when we press the enter key then after each key press event one “<br/>” occurs.
To remove these unwanted <br/>, we need to use the JavaScript approach, which will replaces all the “<br/>” as well as blank spaces (“”) and will provide read only text field in workflow form as multiple lines.
Sample JavaScript code:-
<script type="text/javascript">
var comment = document.getElementById ('UDA_Name”).value.replace (/<br/>/gi,"");
comment = comment .replace (/ (rnr)/gm," ");
document.getElementById (“UDA_Name”).value = comment;
</script>
Last reviewed: 20/02/2012
Author: Kiran Bisht
Attachment: Form_filled_with_textarea_as_Read_Only_.zip