Mailliste webobjects-dev@wocommunity.org Nachricht #643
Von: Theodore Petrosky <webobjects-dev@wocommunity.org>
Betreff: error in ERMODEditRelationshipPage
Datum: Thu, 23 Apr 2026 16:36:02 -0400
An: WO Development <webobjects-dev@wocommunity.org>

I asked on the list if anyone had a problem with turning off buttons on this template (ERMODEditRelationshipPage). the consensus being maybe use css! 

I could not get the edit button to go away. I was about to resort to css, but I decided to figure out my error in logic. So I cloned the template  (ERMODEditRelationshipPage) into my project and started to examine. I found the method that returns the boolean and it did not look right. It looks like, if the edit list is empty or the user is setting the key 'shouldShowEditListButton' to false, do not show the edit button.

public Boolean shouldShowEditListButton() {
        Boolean shouldShowEditListButton = !isListEmpty();
        if (shouldShowEditListButton && ERXValueUtilities
                .booleanValue(d2wContext().valueForKey("shouldShowEditListButton"))) {
            shouldShowEditListButton = true;
        }
        return shouldShowEditListButton;    
    }

However, setting shouldShowEditListButton to false did not work. So I copied and pasted this method into chatgpt and she was very nice. I loved how she mentioned that:

…the method does nothing meaningful.

  • If shouldShowEditListButton is already true, you set it to true again.
  • If it’s false, the if never runs.

👉 So the second condition has no effect at all.

She then gave me some options:

Option 1: Show button when list is NOT empty and flag is true

public boolean shouldShowEditListButton() { return !isListEmpty() && ERXValueUtilities.booleanValue( d2wContext().valueForKey("shouldShowEditListButton") ); }

Option 2: Show button when list is NOT empty or flag is true

public boolean shouldShowEditListButton() { return !isListEmpty() || ERXValueUtilities.booleanValue( d2wContext().valueForKey("shouldShowEditListButton") ); }
I will put this in a pull request to fix it

Most importantly she mentioned that I should be using boolean instead of Boolean

BTW

I asked her what happens if the flag ie. valueForKey("shouldShowEditListButton") were null and chatgpt answered:
It depends on ERXValueUtilities.booleanValue(), but in the Wonder framework (ERX), it is designed to be null-safe.
so she (chatgpt) understood that this is a Wonder project and what goes on in wonder!!! 
How did she understand Wonder? I wonder what else we can ask her to do?
Ted
Einzelnachrichten abonnieren Zusammenfassung abonnieren Index abonnieren Abonnement aufheben E-Mail an Listmaster