on 01-31-2007 4:40 PM
Hi All,
I am running a webdynpro application. It has a textbox and on click of a button the control goes to the next page. I want to check if the text entered in the textbox has the characters "@" or "." present in it. If it is not present then i wish to give a alert message to the user and return the focus back on the text. Else the control goes to the next page.
Any inputs on this please.
Also how to add logging facilities in webdyn pro applications.
Points assured.
Regards
Nikhil Bansal
Hi Mikhil,
use indexOf to check if the text contains the char:
if (textVariable.indexOf('%')>0) .............
the method return - 1 if the character doesn't exist in the string. The same for "."
To show an alert message use this:
IWDMessageManager msg = wdThis.wdGetAPI().getComponent().getMessageManager();
msg.reportException("Error: " + textVariable + "not in string", false);
There are a lot of way to manage the error log but the above is the more simple.
Hope this help.
Vito
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi:
1. I assume that a "text box " is a textEdit
2. detect @ or . by indexOf if <0 , it is not in the string
3. conseqently if index of <0 , i do not go tothe next page
4, message can be done using message pool
String des= "blabla ";
Object[] arg = ;
MessageFormat message = new MessageFormat(wdComponentAPI.getTextAccessor().getText(IMessageItFinPlnComp.ADDITIONALINFO));
String text = (String)message.format(arg);
5.for logging you can have a simpel log like this:
public static void logString(String str) {
try {
FileWriter fw = new FileWriter("C:
temp
group.log", true);
String threadId = Thread.currentThread().getName();
fw.write("" + str + "\r\n");
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
or more complicated using cache and making a commom DC
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.