Javascript Exception: Checkbox UI Only Field toLowerCase exception on Cancel Changes (Banzai 7.20)

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
  • (Edited)
When a model contains a checkbox field, the "cancel changes" action framework action results in a javascript exception.

Steps to reproduce:
1) Create standard account detail page
2) Add checkbox UI only field
3) Add field to editor
4) Preview page
5) "Check" the checkbox
6)  Click cancel button

Notes - It appears to be a problem with the checkbox field not properly getting set in model.originals when the change in step #5 occurs.



Sample Page XML
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account" adapter="" type="">
         <fields>
            <field id="Name"/>
            <field id="CreatedDate"/>
            <field id="CheckboxUIField" uionly="true" displaytype="BOOLEAN" label="Checkbox UI Field" defaultValue="false"/>
         </fields>
         <conditions>
            <condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="Account" uniqueid="sk-2R5OlO-68">
         <maintitle>
            <template>{{Name}}</template>
         </maintitle>
         <subtitle>
            <template>{{Model.label}}</template>
         </subtitle>
         <actions>
            <action type="savecancel"/>
         </actions>
      </pagetitle>
      <basicfieldeditor showsavecancel="false" showheader="true" model="Account" mode="read" uniqueid="sk-2R5OlO-69" buttonposition="">
         <columns>
            <column width="100%">
               <sections>
                  <section title="Basics" collapsible="no">
                     <fields>
                        <field id="Name"/>
                        <field id="CheckboxUIField"/>
                     </fields>
                  </section>
               </sections>
            </column>
         </columns>
      </basicfieldeditor>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
   <styles>
      <styleitem type="background" bgtype="none"/>
   </styles>
</skuidpage>
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hey guys - Any updates on this one?  Thanks!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
I've encountered that toLowerCase problem a bunch of different times since Banzai, in various situations. Generally seems to be a problem with whether there should be quotes around something.
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,470 Points 10k badge 2x thumb
Looking at this now...
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Thanks Ben!
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,470 Points 10k badge 2x thumb
This will be fixed in Banzai Update 5, due out later this week.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Awesome, thanks Ben!
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,470 Points 10k badge 2x thumb
This should be fixed in Banzai Update 5. Available from the http://skuidify.com/skuidreleases page.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Tested and confirmed as resolved as of Skuid 7.24.  Thank you!
Photo of Stephen Chan

Stephen Chan

  • 956 Points 500 badge 2x thumb
Unfortunately we're still having this error under Skuid 7.24 when calling updateRow - this used to work fine yesterday (AFAIK):
Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
o @ skuid__SkuidJS:27(anonymous function) @ skuid__SkuidJS:28o.extend.each @ skuid__JQuery:2(anonymous function) @ skuid__SkuidJS:28o.extend.each @ skuid__JQuery:2W.updateRows @ skuid__SkuidJS:28W.updateRow @ skuid__SkuidJS:28(anonymous function) @ skuid__UI?page=FrondeVisitorSignIn:517o.extend.each @ skuid__JQuery:2(anonymous function) @ skuid__UI?page=FrondeVisitorSignIn:515o.extend.each @ skuid__JQuery:2(anonymous function) @ skuid__UI?page=FrondeVisitorSignIn:514(anonymous function) @ skuid__SkuidJS:28j @ skuid__JQuery:3k.fireWith @ skuid__JQuery:3e.(anonymous function) @ skuid__JQuery:3(anonymous function) @ skuid__SkuidJS:22(anonymous function) @ skuid__JQuery:3j @ skuid__JQuery:3k.fireWith @ skuid__JQuery:3e.(anonymous function) @ skuid__JQuery:3(anonymous function) @ skuid__SkuidJS:28j @ skuid__JQuery:3k.fireWith @ skuid__JQuery:3e.(anonymous function) @ skuid__JQuery:3a.remote.load.escape @ skuid__SkuidJS:27e.cb @ VFRemote.js:133VFExt3.direct.RemotingProvider.VFExt3.extend.doCallback @ VFRemote.js:99VFExt3.direct.RemotingProvider.VFExt3.extend.onData @ VFRemote.js:94VFExt3.extend.handleResponse @ VFRemote.js:75a @ VFRemote.js:39(anonymous function) @ VFRemote.js:40
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hi Stephen -

In reviewing the call stack, this appears to possibly be a slightly different scenario but a similar issue.  With only the call stack, its difficult to say exactly what might be occurring here.

My recommendation would be to create a new community topic with the call stack above and a small repro or at least an explanation of the action sequence that is occurring when you encounter the problem.  Starting a new issue will provide better visibility to Skuid that something is wrong then updating an issue that is marked solved.   You can reference this issue in your new post just in case they are the same and as a point of reference.  I'll keep an eye out for the new post and see if I can provide some assistance as well.
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,470 Points 10k badge 2x thumb
Thanks Barry and Stephen, that's my analysis as well. The call stack isn't quite enough for me to work with, I'll need a little bit more detail on the setup.
Photo of Stephen Chan

Stephen Chan

  • 956 Points 500 badge 2x thumb
Thanks for the responses guys. It's weekend time here so I won't be able to spend the time right now to isolate the issue and raise a new case until Monday. But given it's still Friday for you I did have another look at it and one more clue or theory I have is that it is something to do with updating a row on a model with a boolean field to a value of undefined. I know that I should be setting true/false and will look at fixing that later but Skuid used to handle an undefined value on a boolean field and set it to false (I think). This seems to me to be more related to Barry's issue than it appears if his checkbox UI field is sending an undefined value on cancel? Anyway hope that helps in the meantime. Apologies I can't give you more detail right now but can do in a couple days. Thanks!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hi Stephen -

Skuid should never encounter a javascript exception so I completely agree regardless of what you are/aren't setting, there is a problem that needs to be resolved here.

Just from looking at the call stack and your last comment, my guess is that you are calling "save" on a model possibly and it is during that action sequence that the exception is encountered?

Unfortunately, the methods in the call stack are used in lots of different places within the skuid runtime, so it's difficult to say what sequence of events and model situations is leading to the unintended behavior.  If you could provide a little more background on what is going on when the exception occurs that would be very helpful.  For example:

1) Are these "new" rows or "existing rows" or both?
2) Is the checkbox field a UI Only field or an SFDC SObject Checkbox field?
3) If UI Only do you have default value = true (checked)?  If SFDC SObject, what is the default value for the field (true/false)?
4) What if the action sequence (save, cancel, requery, etc.)?  If multiple, please provide the full set of steps.

Would be ideal if you could put together a small sample when you are back on Monday but in the meantime, if you could provide some additional context it would help us try to identify what is going on.
(Edited)