Bookmark Topic Watch Topic
  • New Topic

Trying to evaluate lt%= fieldName.toString() gt from with an onblir

 
Trish Hartnett
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,

I know that this question is similar to a question that was placed on the JSP list last January.
http://www.coderanch.com/t/288842/JSP/java/Calling-java-script-function-js

Unfortunately the solution mentioned in that thread didn't solve the problem for me. So please excuse me for asking my question here.

I've had to replace all "lt" and "gt" with lt and gt because when I tried to post the topic initially I got the error message:
"We cannot post your topic because the subject contains lt or gt. Subjects may not contain this combination of those characters. Use your back button to try again."
Also apparently the JavaScript which checks all new posts also has problems with onblXr, (where X is "u") so I'm changing all mentions of onblXr to onblir.

I'll try and make my code as readable as possible and I'm sorry for the slightly unreadable code.

I have a JSP file and I want to do validation in JavaScript using onblur().

For the validation I need to pass the JavaScript a variable called fieldName.
fieldName is defined as:
lt bean efine id="fieldName" name="staticDataItemList" property="name" /gt

The JavaScript method which is doing the validation is called printAlerts.

To call the JavaScript validation I am using the line:
lt html:text name="staticDataItemList" property="value" size="50" onblir="printAlerts(' lt%= fieldName.toString() gt ')" / gt

I was hoping that when that the resulting HTML would have the actual field name as an argument for printAlerts, i.e. if the value of fieldName was itemName, the HTML would look like:
lt input type="text" name="staticDataItemList[3].value" size="50" value="" onblir="printAlerts('itemName')" /gt

Instead the resulting HTML is :
lt input type="text" name="staticDataItemList[3].value" size="50" value="" onblir="printAlerts(' lt%= fieldName.toString() %gt ')" /gt

Can anyone suggest anything please ?

Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!