Ability to check if a field has already been rendered

edited December 13, 2019 in Questions
I have a field in my page and I am overriding the handleChange method for the field with some fairly complex behavior.

Part of this behavior depends on the data in another model. So I need to be able to call the snippet that sets up my field when certain events are thrown.

The issue is right now, I am getting duplicate instances of the field (and the entire editor it belongs to for that matter - see attached screen grab).

I belive this is because I am calling render multiple times.

So what I need is logic to be able to tell if the field has been previously rendered or not, and only render the first time if that makes sense, and simply override the handleChange function otherwise.

Any help on this would be appreciated.

image

Comments

  • edited December 13, 2019
    Never mind, got it sorted. It was not the multiple field.render() calls that was causing this.
    I simply had been creating new rows in the model!

    Mystery solved.
  • Anna WiersemaAnna Wiersema 🛠️ 
    edited December 1, 2015
    Thanks for letting us know, Hamza!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!