Multiple choice HTML code

Elements templates don’t support inline conditional expressions like @if(multiple == 'bbb').

Instead, handle your logic in hooks.js and pass the processed values back into the template.

Here’s an example:

const transformHook = (rw) => {
  const { multiple } = rw.props;

  rw.setProps({
    wantsA: multiple === 'aaa',
    wantsB: multiple === 'bbb',
    wantsC: multiple === 'ccc',
  });
};

exports.transformHook = transformHook;

Then, in your template, you can use those props directly:

@if(wantsA)
  A is wanted
@endif

@if(wantsB)
  B is wanted
@endif

@if(wantsC)
  C is wanted
@endif

For more details, check the Hooks.js documentation. Let us know if you need more help :slight_smile:

1 Like