This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

kattsoff
kattsoff

Hi! I have a problem with form. If a have something like this in fields.yaml:


fields:
  title:
        label: rainlab.blog::lang.post.title
        span: left
        placeholder: rainlab.blog::lang.post.title_placeholder

    slug:
        label: rainlab.blog::lang.post.slug
        span: right
        placeholder: rainlab.blog::lang.post.slug_placeholder
        attributes:
            data-input-preset: 'input[name="Post[title]"]'
            data-input-preset-type: slug
            data-input-preset-closest-parent: form

On create page form it works fine, but if I save it, and try to update title field it doesn't work.

Flynsarmy
Flynsarmy

You probably didn't get a reply because 'it doesnt work' isn't a valid error description and is helpful to noone. You need to describe the issue you're having, what you're seeing, expected results, any error messages etc.

I also notice your YAML isn't indented properly. title isn't indented enough. This may cause issues.

Last updated

kattsoff
kattsoff

Ok, let me describe it more properly. In CMS we have functionality for creating new pages. When I create a page in CMS, I can define a title and as a result an URL is updating automaticaly. But if I save it and try to update a title, an URL isn't updating.

Flynsarmy
Flynsarmy

That's because the slug field in your DB is already set - so your field has a value now. The data-input-preset stuff only works when no slug already exists and the field starts empty.

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.