Neither formula field nor model action fire when field is cleared

PaulPaul ✭✭
edited September 2019 in Problems
Hello,
I have an input field that is used in a calculation and I'd like to trigger an action on.  Everything works as expected when a user enters a value, however, if the user enters a value, then backspaces/deletes it... nothing happens.  If they then enter "0", everything fires as it should, but the blank doesn't seem to be picked up.

The interesting thing is conditional rendering based on it works - but the formula recalculation and action framework seem to ignore it.

Any thoughts on how to force a field be blanked out to fire or be updated to a '0'?

Thanks!

Comments

  • edited September 2019
    I'm not quite picturing your requirement, but I did have something a couple years ago that sounds similar.

    My field is in a Field Editor, on a single/new-record model. (The field editor is in a popup; the action steps before showing the popup include a Create Row.) 

    There are two iterations* of the field (which is a Number datatype). One is a Required field, rendered when the model has no data rows. The other iteration is not required and is rendered when the model does have data rows. As the user interacts with the field, the two iterations are toggled. The Required attribute also prevents the blanks. At least, this is how I recall it working. I would need to do a little testing to refresh the memory, but maybe that's idea enough to get you going a little farther.

    * Iterations, or occurrences. One field is placed under the other; only one at a time is displayed, according to the rendering rules.
  • PaulPaul ✭✭
    edited September 2019
    Not quite the same, to simplify, imagine I have a field called Foo. I enter "5" in the field. Everything works as expected. Then I go to the field and hit the backspace or delete. Nothing happens. Ui formula fields don't recalculate, model actions don't fire. Nothing. If I enter "0" it does, but clearing the field is as if nothing happened.
  • edited October 2018
    Paul,

    I was able to reproduce what you are seeing in my developer org.  I am not sure of this, but I think Skuid is ignoring the backspace or delete keys for detecting a change to the field.

    If you want the formula field to be cleared or set to zero when backspace/detele is used, implementing a custom field renderer should work.

    Thanks,

    Bill
  • PaulPaul ✭✭
    edited October 2018
    Hi Bill,
    Perhaps I'm missing something, but how does a custom field rendering update a formula field?  So if I have a and b (both input fields) and a custom ui-formula that is a+b, if a is cleared, I need the calculation in a+b to be updated to be correct.  Does rendering something force a recalc or something?

    Thanks!
    Paul
  • edited October 2018
    Paul,

    What I am proposing is to write a snippet that would render fields 'a' and 'b'.  The snippet would handle the calculation and update of field 'c'.  Field 'c' would replace your formula field---just change the UI Only field type to 'Number'.  I am pretty sure that the snippet will 'fire' even when backspace is used.  The snippet can detect if field 'a' or 'b' is empty and then use a '0' for field 'a' or 'b' in the calculation of 'c'.

    Thanks,

    Bill
Sign In or Register to comment.