A most unusual bug!

A most unusual bug!

This week I had a VERY unusual bug. Here's the scenario:

* A Record List containing a Web Block that had an Edit Record in it (let's call this Edit A).
* Within Edit A, a Web Block with another Edit Record (Edit B).
* Buttons/links outside of the Record List to create a record for Edit A, populate it with basic default values, then refresh the query to populate the Record List and an AJX Refresh on the Record List.
* The Web Block containing Edit B had parameters to either show or hide the "Save" button; if it was running inside Edit A, they would be hidden and all of the changes would be saved "On Change", otherwise it would need the "Save" button to be clicked.

Simple enough.

Well, what was happening was that I was getting a client-side only error, that was being caught and turned into a Feedback Message style alert to the user. There were no details, other than it telling me that an item it was looking for was not defined and "OS Client Script" error. Browsing through the HTML & JavaScript, I couldn't find the item that it was missing, or any references to it. I guess that was all being generated at runtime. Breakpoints in JavaScript pointed to the problem being related to validation, and tearing down the screen for the AJAX Refresh.

The only way I could make this work was to use a Submit instead of an AJAX Refresh, which was providing a poor user experience once the list got long enough to need scrolling. I tried setting validations to "None" and that didn't work.

After a LOT of frustration, I found the issue. To debug it, I started removing elements in Edit A to see what was causing it. It was provably Edit B. Then in Edit B, I started removing elements. The problem was the "Save" button! I had been hiding the "Save" button when not in use by hiding the whole row with "display: none". In addition, I wrapped the "Save" button in an If Widget, to keep it from going to the screen at all.

Problem solved!

Hi Justin, 

I've seen a lot of that happening special in apps developed in previous versions (4.2 and 5)

Ricardo -

I think some of these issues could be fixed be allowing Tables/Lists/Edits to be nested inside each other.

That bug is really frustrating.. :(
I'd say the problem is the if widget. And the fact that the generated validators don't take them into account. To be fair, could they, since the if widget is only evaluated at runtime?

When the JavaScript validators tried to validate the non-existing button, boom, they broke.

Maybe we need a "On Error Resume Next" directive in JavaScript :)
Carlos Ribeiro da Fonseca wrote:
Maybe we need a "On Error Resume Next" directive in JavaScript :)
 Ouch, below the belt :)