How to prefill time fields and agree fields #1791
Replies: 4 comments 5 replies
-
Also, I tested this on Chrome, Edge and Firefox, on a Windows 11, no browser shows them |
Beta Was this translation helpful? Give feedback.
-
Doesn't seem to do much. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
the time table seems to be fixed with the 2.1.9 release. |
Beta Was this translation helpful? Give feedback.
-
Hi all, I'm having trouble to prefill some fields.
I have an entry type 'Location'.
There, I have a table field 'locationOpeningHours' with my columns being the days,, as time fields, and max 1 row:
I also have some lightswitches, for example, the field 'locationHasDisabledToilet'. It doesn't have any labels, so it simply works with 0 and 1.
I have a formie form, that should read out everything from my location entry, and save any changes made when submitting the form.
The opening hours on the form is a table field with time rows:
The lightswitches are represented in a group field, containing agree-fields:
Submitting the form does change the values in the entry, so that side works.
However, the prefilling for these fields doesn't work.
The lightswitches do seem to have a value, but they don't appear checked:
I used following code:
{% do craft.formie.populateFormValues(form, {
locationAccessibility: {
locationHasDisabledParking: [ location.locationHasDisabledParking|t ],
locationHasDisabledToilet: [ location.locationHasDisabledToilet|t ],
locationHasParkingBicycles: [ location.locationHasParkingBicycles|t ],
locationIsWheelchairAccessible: [ location.locationIsWheelchairAccessible|t ],
}, .....
The opening hours don't seem to have anything set.
I tried following code:
locationOpeningHours: [
{
col1: location.locationOpeningHours[0]['maandag'],
col2: location.locationOpeningHours[0]['dinsdag'],
col3: location.locationOpeningHours[0]['woensdag'],
col4: location.locationOpeningHours[0]['donderdag'],
col5: location.locationOpeningHours[0]['vrijdag'],
col6: location.locationOpeningHours[0]['zaterdag'],
col7: location.locationOpeningHours[0]['zondag'],
},
], .....
but this doesn't seem to do anything at all. I tried putting '|date('H:i')' after the value, but also to no avail.
What am I missing here?
I'm using Formie 2.1.3 and Craft 4.6.0
Beta Was this translation helpful? Give feedback.
All reactions