Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can put your own <include> in your xwork.xml interchangeably with
<package> elements... They will be loaded in the same order as it reads
from top to bottom and adds things as it reads them.

How can I put a String literal in a Javascript call, for instance in an onChange attribute?

The problem is in escaping quotes and getting the double quotes around the final value, like we expect in HTML attributes. Here's an example of the right way to do this (thanks to John Brad):

Code Block

onchange='"someFunc(this.form, \'abc\')"'

Notice here that there are single quotes surrounding the double quotes, and then the single quotes inline in the Javascript are escaped. This produces this result:

Code Block

onchange="someFunc(this.form, 'abc')"