Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Code question

    Code:
    if (this.parentElement.frmCauseHumanFactorCode.valuesHaveChanged())
    {
    this.parentElement.frmCauseHumanFactorCode.saveData("checkState(this.parentElement.ID, 'post')");
    }
    Why the Browser complains about this.parentElement.ID used as a parameter for checkState function sayng that parentElement has no properties?

    #2
    Because your callback: "checkState(this.parentElement.ID, 'post')" is evaluated in a different context, where 'this' has a different meaning than it does where you're making the saveData call.

    In this kind of situation, you can work around this as follows:

    Code:
    if (this.parentElement.frmCauseHumanFactorCode.valuesHaveChanged())
    {
    this.parentElement.frmCauseHumanFactorCode.saveData("checkState('"+this.parentElement.ID+"', 'post')");
    }
    So what will execute in the above example is e.g:

    checkState('someID', 'post');

    Makes sense?

    Comment

    Working...
    X