on 01-12-2015 10:47 AM
Hi Jagannadh,
i will give one suggestion create 2 text area fields using thtmlb:textArea tag here one is for note and another is for count...
ex:
it looks like this..
when ever your are changing the data in text box the count will vary..
this is the sample code..
<script type="text/javascript">
var Count = null;
function OnClick(onKeyUpTextArea) {
if (Count == null) {
thtmlbUtil.addEventHandler(onKeyUpTextArea, "keyup", myOnKeyUpHandler);
Count = onKeyUpTextArea;
}
}
function myOnKeyUpHandler() {
if (Count) {
var TextAreaID = Count.id.replace("onKeyUp", "reporting");
var reportingTextArea = document.getElementById(TextAreaID);
if (reportingTextArea) {
reportingTextArea.value = Count.value.length;
}
}
}
</script>
<htmlb:label for = "Note"
text = "Type your data in Textarea/Textbox" />
<br />
<thtmlb:textArea id = "onKeyUpTextArea"
text = "Hello Experts..."
onClick = "OnClick(this);" />
<htmlb:label for = "Char"
text = "Character Left" />
<thtmlb:textArea id = "reportingTextArea"
rows = "1"
text="16"/>
<br />
Try this and let me know if you have any queries..
Thanks & Regards,
Srinivas.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Srinivas,
Thanks for your quick response and helpful solution. But I need this requirement for standard text area field. Is it working for the standard text area field. If its works for the standard text area field, then in the above solution where I will give the standard text area field name. I tried but not success.
Can you please explain elaborately ?
I am using this component : GSTEXT
view : GSTEXT/Text (Text.htm)
text area filed name : LINES.
Kindly refer the GSTEXT component. you will understand my requirement.
Hi Srinivas,
I am also having similar requirement. In the main text area, when I type more than 150 chars, it should raise warring message. I tried to use your above java scripting reference code with only one text area(standard Text field in Notes assignment block) with field name LINES.
Code line:
reportingTextArea.value = Count.value.length;
if "reportingTextArea.value" is greater than 150 Chars, I am calling "alert" command for raising the message but it didn't work.
alert( 'Please enter less than 150 Chars' );
Could you please suggest.
Thanks in advance!!
Regards,
Shaik
Hi Shaik,
First of all Sorry for the late reply...
In that case you have to get the standard text field ID (LINES) based on that count the characters which you have passed in the notes field and based on length have to rise the alert..
this is the snippet code for that..
<%
data: lv_fieldname type string,
lv_contextnode type string,
lv_id type string.
lv_fieldname = 'links'. " fieldname ( only small letters )
lv_contextnode = 'contextnode'. " context node name in which the field is present.
CONCATENATE controller->component_id '_' lv_contextnode '_' lv_fieldname INTO lv_id.
<script type="text/javascript">
var NoteID = document.getElementById("<%= lv_id %>");
NoteID.addEventListener("keyup", myFunction);
function myFunction() {
var count ;
count = document.getElementById("<%= lv_id %>").value;
if(count.length == 10) {
alert("Please enter less than 10 Chars ");
}
// this is for display the count in input field...
document.getElementById("NoteId").value = count.length;
}
</script>
<thtmlb:textArea id = "NoteId"
rows = "1"
text = "" />
Regards,
Srinivas.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.