• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Need help assign java string to java script variable

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's the purpose of the scriptlet?
 
My cellmate was this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic