Closed krausste closed 6 years ago
This is working as intended now in 2.9.x. Please reopen if you find a condition otherwise!
Hi Jack, unfortunately this is still not working for us in 2.9.6. I will add some screenshots. Can you please reopen the ticket? Thank you!
Alright, trying again with his exact setup. 🙏
great! thank you :)
Confirmed. I must have been testing it wrong. Will get it fixed up for 2.9.7. 👍
Found it. The default
is probably stored as a string
, and therefore not matching the int
value in the options object. With a little type coercion, we're back in business.
If you need this fixed immediately, you can pop open the fieldset yaml file directly and remove any string quotes:
options:
1: First
2: Second
3: Third
default: '2' # change to 2
Alright, thank you!
Hi there, this is still not fixed in 2.9.8. default int values are still stored with quotes inside the yaml config file.
Correct, we couldn't change that, but the loading side checks if the string is numeric and type casts it back to an int so the display shows correctly. You said it's not fixed because it's not saved as an int, but does it work as expected?
Nope, also not working as expected. Only when removing the quotes manually its working.
Can you post the fieldset config for the field you're using?
sure. see field_9
and quote
set inside the bard field
title: Long Form Post
hide: true
sections:
main:
display: Main
fields:
title:
type: text
display: Title
localizable: true
section_1:
type: section
display: Section 1
template:
type: hidden
default: blog/long_form
long_form:
type: bard
display: Long Form Content
sets:
image:
display: Image
fields:
photo:
display: Photo
type: assets
container: main
folder: img
max_files: 1
caption:
type: text
size:
type: radio
default: Normal
options:
Normal: Normal
Oversized: Oversized
quote:
display: Pull Quote
fields:
quote:
display: The Quote
type: markdown
cite:
type: text
display: Cite
select:
type: select
display: Select
options:
10: Label 1
20: Label 2
30: Label 3
default: "10"
grid:
display: Grid
fields:
grid:
type: grid
display: Grid
fields:
text:
type: text
display: Text
text_2:
type: text
display: Text 2
togggle:
type: toggle
display: Togggle
mode: table
spellcheck: true
allow_source: true
section_2:
type: section
display: Section 2
text:
type: text
display: Text
tags:
type: taxonomy
taxonomy: tags
field_9:
options:
1: label 1
2: label 2
type: select
display: Field 9
default: "1"
taxonomies: true
Expected behaviour
The text of the default option is shown instead of the value. And the value is saved without enclosing quotes (which might be the cause of the issue somehow - after choosing another option the int value is saved without quotes).
Actual behaviour
The default value is shown instead of the text that belongs to the default's value option.
Steps to reproduce
Server Details
Statamic Version: 2.8.7