If, elseif etc... second opinion

Hi folks;

I Think I am using the following correctly but the output says differently;

<% if [windowname[]is[blank]] %>
   <span title="window.name NOT set">❓</span>

    <% elseif [{$:/config/window.name}is[blank]] %>
      <span title="$:/config/window.name NOT set">!</span>
<!--       <$button tooltip=`Configure as $(current-window-name)$` set="$:/config/window.name" setTo=<<current-window-name>>>Configure</$button> -->
      <$button tooltip=`Configure as $(current-window-name)$` actions=<<set-window-name-and-config-actions>>>Configure 2</$button>
   <% else %>
      ''$:/config/window.name = ''{{$:/config/window.name}}''
      <$button tooltip="Use configured as window.name" actions=<<set-window-name-config-actions>> >Use configured</$button>
   <% endif %>
<% else %>
    <% if [windowname[]match{$:/config/window.name}] %>
       <span title="window.name is as configured">✔️</span>
    <% else %>
       <span title="window.name NOT as configured">❓</span>
   <% endif %>
<% endif %>

Output;

At least a second set of eyes may be able to tell me what is wrong with my syntax.

Thanks in advance.

This may be the cause, Checking now. Imbalanced bold indicators

Your syntax seems to be wrong. if, elseif, else, endif is one structure. The following else has no if
I did not check the code, only the if-conditionals

<% if [windowname[]is[blank]] %>
   <span title="window.name NOT set">❓</span>
<% elseif [{$:/config/window.name}is[blank]] %>
    <span title="$:/config/window.name NOT set">!</span>
    <$button tooltip=`Configure as $(current-window-name)$` actions=<<set-window-name-and-config-actions>>>Configure 2</$button>
<% else %>
      ''$:/config/window.name = ''{{$:/config/window.name}}''
      <$button tooltip="Use configured as window.name" actions=<<set-window-name-config-actions>> >Use configured</$button>
<% endif %>

<!-- The following else is wrong here -->
<% else %>
    <% if [windowname[]match{$:/config/window.name}] %>
       <span title="window.name is as configured">✔️</span>
    <% else %>
       <span title="window.name NOT as configured">❓</span>
   <% endif %>
<% endif %>
1 Like