Help anyone? Javascript for OpenERP

I think you can probably write an xpath expression to find that element.

If you

  • open a sample page in Chrome and right-click / ctrl-click the field, and
  • choose 'Inspect element'

You will be able to drill down through the expansion triangles in the elements view until you are selecting just your target element, and then

  • right-click / ctrl-click it
  • choose Copy XPath (Chrome only, Safari doesn't offer this form of copying)

and begin your understanding of XPath paths (a bit like file directory paths) by pasting what you have got into a text editor.

The automatically copied path will probably be a bit literal and absolute, and you may need to craft something a bit more general (perhaps, for example, allowing for the variations in that numeric suffix).

You can test and refine your XPath interactively with the ⌘F Find panel in Chrome or Safari elements view (both browsers accept XPaths as well as simple strings in their Elements views).

Once you have an XPath that reliably finds (and only finds) the element you want, you can use 'document.evaluate(strXPath)' in a KM 'Execute Javascript in Chrome|Safari' action.

You will find some examples of XPath use from KM in other threads in this forum. Most recently, I think: