on 10-05-2009 8:29 AM
Hi Experts
I have a requirement to limit the number of characters being entered in a textedit, and also to display the number of characters remaining as the employee types.
I know that I can limit the number of characters customizing the data type linked to the field, but how do I show the remaining characters?
There are no Events linked to the textedit filed that I can make use of.
Thanks in advance.
Anton Kruse
Hi
How the data will be there in Textedit
1. Is user will enter the data or
2.This field will prefilled through context attribute.
Second one right?
String text = wdcontext.currentcontextelement.getText(); //It has the whole current value
//Example
public class SubstringExample1{
public static void main(String[] args){
String string = "Rajesh kumar";
System.out.println("String : " + string);
String substring = string.substring(3);
System.out.println("String after 3rd index:
" + substring);
substring = string.substring(1, 2);
System.out.println("Substring (1,2): " +
substring);
}
}
BR
Satish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anton,
I don't think there's an active listnener for WD-Java UIs so you can manipulate the text being entered on the UI element. What you can only do is post-action checks or validations. Just like what the rest are telling you... or just prompt the user that they have entered an invalid number of characters for the following field.
Regards,
Jan
Hi
If data source is context then you can parse it through JAVA STRING utility like take the complete string in one temporary variable then print the remaning characters Since all the time Input length will constants so just write one method with these parameter and use it everywhere.
Hope I am clear?
Best Regards
Satish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well the type of functionality you want is Client side scripting which is not supported in Web Dynpro. You cannot have mousedown, keypressed eventing in Web Dynpro as Web Dynpro supports only server side scripting. So most likely after the user has typed the details you may trigger a validation using the supported events and check the no. of characters he/she has entered.
Chintan
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.