Removing a previously installed soft-bar

To complete the form we need to add an event handler and button for removing the soft-bar. The handler will use the sb:RemoveBar function and pass it the internal name of the bar. Add the following to the model:

      </xf:action>

      <xf:action ev:event="my-remove-bar">
        <xf:setvalue
         ref="@retval"
         value="sb:RemoveBar(string(../internalName))"
        />
        <xf:message level="modal">
          '<xf:output ref="name" />'
          has
          <xf:output value="
            if(
              @retval = 'Success',
              ' been removed. You will need to open a new browser
                window to see the change.',
              concat(
                ' failed to be removed. The error is &#34;',
                @retval,
                '&#34;.'
              )
            )"
          />
        </xf:message>
      </xf:action>
    </xf:model>

To invoke the handler we need another button:

    </xf:trigger>

    <xf:trigger>
      <xf:label>Remove</xf:label>
      <xf:dispatch ev:event="DOMActivate"
       name="my-remove-bar" target="m-soft-bars"
      />
    </xf:trigger>
  </body>