Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I safely check for a blank Text property of an htm
#1
I'm using the Text function of an htm to gather data for a report.
All works well as long as the htm element isn't blank.
If it's blank, I get a runtime type mismatch.
Is there a safe way to check for the absence of text before calling the Text function?
#2
Open Htm.Text and add err after getAttribute. If it is not editable, uncheck read-only in System folder properties. After editing, export-replace System folder.

Code:
Copy      Help
function~ ;;Get text.
if(!el) end ES_INIT

str s=el.innerText
if(!s.len) s=el.getAttribute("value" 0); err
ret s

err+ end _error

getAttribute returns VARIANT. This error is generated if its type is VT_NULL.


Forum Jump:


Users browsing this thread: 1 Guest(s)