on 02-01-2007 3:57 AM
Hi,
I'm very new to this. I am following the guidelines in SAP network and trying out some code.
can anyone tell me why the following<b> javascript</b> is not working??
I'm using <b>Dynpage</b>.This is one input field in my form.
InputField first = new InputField("first");
first.setType(DataType.STRING);
first.setMaxlength(400);
first.setClientEvent(EventTrigger.ON_CHANGE, "validateName()");
and the javascript code is,
Document doc = getDocument();
doc.addRawText("<script>" +
"function validateName() " +
" { " +
" var funcName = htmlb_formid+ '_getHtmlbElementId'; " +
"func = window[funcName];" +
" var val = eval(func('first'));" +
"alert(val);" +
"var val1=val.getValue();" +
"if (val1 != 'anand') " +
"alert('Enter correct name'); "+
"if((val1.charAt(0)=='0')||"+
"(val1.charAt(0)=='1')||(val1.charAt(0)=='2')||"+
"(val1.charAt(0)=='3')||(val1.charAt(0)=='4')||"+
"(val1.charAt(0)=='5')||(val1.charAt(0)=='6')||"+
"(val1.charAt(0)=='7')||(val1.charAt(0)=='8')||"+
"(val1.charAt(0)=='9')) "+
"alert('Name should not start with a number'); }</script>");
But this is not working.
yes.I got it now. I made a mistake.
didnt give
first.setJSObjectNeeded(true);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.