Script to autogenerate slug doesn't work

I have written a script to autogenerate slug like a documentation says.

ctx.data.slug.iv = slugifx(ctx.data.title.iv);
// Tell Squidex that the content should be replaced.
replace();

I tried also with

var data = ctx.data;

 // Create the slug only if the title has been set and the the slug has not been set
 if (data.title && data.title.iv) {
        data.slug = { iv: slugify(data.title.iv) };
    replace(data);
 }

Using the old squidex version this code worked, but using 5.9.0 squidex gives an error, slug.iv : the field is mandatory

Thanks,
Federica

I’m submitting a…

  • [X ] Regression (a behavior that stopped working in a new release)
  • [ X] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Environment

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ X] Self hosted with other version
  • [ ] Cloud version

Version:5.9.0

Browser:

  • [X ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

I think the order has been changed:

  1. Validation
  2. Script

Therefore you have to make the field not required anymore.

Thanks! it works

Federica

1 Like