• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help assign java string to java script variable

 
karthik rajakumaran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I can not get the following string declared in java in java script.
here is the code,

function isVaildAddress(addVal, helperMsg,min, max){
<%splChars = "/[\"<^>&\'\\]/";%>
var splChars = "<%=splChars%>";
alert(splChars);
var retVal = true;
var i = addVal.search(splChars);
if(i != -1){
alert(helperMsg + " should not contain the following special characters : " +splChars);
retVal = false;
}
if(addVal.length >= min && addVal.length <= max){
retVal = true;
}else{
alert(helperMsg + " will allow " +max+ " digit alphanumeric only");
retVal = false;
}
return retVal;
}

but the alert shows only /["<^>&'\]/
it throws Script error for incomplete the regex expression

Any one can help me to assign the actual string value.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information.

Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the purpose of the scriptlet?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!