Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can no longer save certain data types #1390

Closed
ThosG opened this issue Mar 17, 2018 · 6 comments
Closed

Can no longer save certain data types #1390

ThosG opened this issue Mar 17, 2018 · 6 comments

Comments

@ThosG
Copy link

ThosG commented Mar 17, 2018

Using Grav v1.4.1 - Admin v1.7.1 and Bones theme. Until recently, I could create a new page in the Admin panel, but now (possibly since updating Admin) I can create some types of page but one type doesn't work any longer: on pressing Save there is no response.

Here is the blueprint of the type that doesn't work.

title: Published-item

form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        item:
          type: tab
          title: Form for Published Items

          fields:
            header.title:
              type: text
              label: Reference No
              validate:
                required: true

            header.composer:
              type: text
              label: Composer
              validate:
                required: true

            header.short_title:
              type: editor
              label: Short title, eg 'Paris' - NOT the subtitle - this is used for listings in 'New pieces' etc
      
            header.full_title:
              type: editor
              help: Complete title; see docs for use of bold and italics
              label: Full title
              validate:
                required: true
      
            header.subtitle:
              label: subtitle, e.g. 'A masque'
              type: editor
              label: Subtitle
                
            header.ensemble:
              type: text
              label: Ensemble (eg soprano, 2 violins, and bc)
              validate:
                required: true

            header.editor:
              type: text
              label: Editor
              help: Use this for 'Edited by PDQ Bach' or 'Introduction by A. Scholar'.

            header.itemlist:
              name: itemlist
              type: list
              label: List of items, eg a list of songs. One item per line. Click Add item to start
              fields:
                .an_item:
                 type: text
                 label: an item
          
            header.searchable:
              type: toggle
              label: searchable?
              default: 1
              options:
                    1: PLUGIN_ADMIN.YES
                    0: PLUGIN_ADMIN.NO
              help: best to leave this alone
              validate:
                type: bool
                required: true
      
            header.price:
              type: text
              label: Price in GBP (no £ sign please)
              validate:
                required: true

            header.featured:
                help: set to 1 if you want to mark this 'New'
                type: toggle
                label: featured as new?
                default: 0
                options:
                    1: PLUGIN_ADMIN.YES
                    0: PLUGIN_ADMIN.NO
                validate:
                    type: bool
        
            header.in_prep:
                help: Mark to appear under Future Titles
                type: toggle
                label: in preparation?
                default: 0
                options:
                    1: PLUGIN_ADMIN.YES
                    0: PLUGIN_ADMIN.NO
                validate:
                    type: bool

            header.cover_image:
              type: file
              label: cover image - JPG
              filesize: 2
              destination: '@self'
              accept:
                - image/*

            header.sample_page:
              type: file
              label: Sample music page - PDF
              destination: '@self'
              filesize: 2
              accept:
                - application/pdf
                - application/x-pdf

            content:
                type: editor
                label: Full description
                size: large

Have the requirements for blueprints changed?

@rhukster
Copy link
Member

No blueprints have not changed in 1.4, but there have been some fixes with form validation. What version did you update from? I think if you have not updated in some time, you are running into an issue where you don't have some field that is now required. This was changed during 1.3 version though. Usually, it's best to extend default page for this reason.

@ThosG
Copy link
Author

ThosG commented Mar 18, 2018

I've been keeping it updated, so it was 1.3.

I just tried adding what I hope does the extending, so the blueprint now starts:

title: Published-item
@extends:
    type: default
    context: blueprints://pages

It hasn't made any difference, alas. But that might be because I pruned the default of anything I thought I didn't need.

I don't fully understand about the extending: what does context: blueprints://pages do? I was following the section headed 'Create a completely custom page form' in the docs, here, because I didn't understand the other alternative.

@ThosG
Copy link
Author

ThosG commented Mar 18, 2018

I have now recreated the original default page blueprint, and I still can't save from the Piece blueprint, although I can save from a different blueprint. Can it be a problem with my yaml that is being picked up in 1.4 but wasn't picked up in 1.3?

@ThosG
Copy link
Author

ThosG commented Mar 18, 2018

OK, I think I have it. Editor-type fields can't be marked as required at present. I presume that's a bug.

This is what happens. One of my fields is defined like this:

        header.full_title:
          type: editor
          help: Complete title; see docs for use of bold and italics
          label: Full title
          validate:
            required: true

That doesn't save from the admin panel. But if I remove the validation, it works fine. I.e. this works:

        header.full_title:
          type: editor
          help: Complete title; see docs for use of bold and italics
          label: Full title

@rhukster
Copy link
Member

Hah, i didn't see you had replied here. And I narrowed it down to the same thing. Yes, that looks like a bug.. i'll create a new one for this issue.

@w00fz
Copy link
Member

w00fz commented Mar 22, 2018

Hey @ThosG I resolved this issue, please have a look at my comment in #1393 (comment) for a throughout explanation and if you could give this a test that would be very appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants