what POST values are required to update nodes containing CCK Date fields via cURL?

by nsf81   Last Updated December 22, 2017 15:07 PM

In brief:

I am tasked with maintaining a Drupal based site but can only access it via the web.

  • I have several hundred nodes that are incorrectly formatted/missing content
  • I wrote a class to simplify batch create and update activity via cURL and can successfully update moderately complex content types
  • I cannot update nodes that have date fields and recurrence, when I try, the return is the form you'd find at /node/$id/edit with the fields populated with the same values I tried submitting and with this error:

    • An illegal choice has been detected. Please contact the site administrator.
    • An illegal choice has been detected. Please contact the site administrator.
    • The UNTIL value is required for repeating dates.
  • I also cannot create a new node of any type that has a date field.

I am assuming the problem has something to do with the date fields. Pages, which do not have a date field, update without complaint.

The default values I'm submitting, in addition to taxonomy, cck text fields, the standard title and body, and identical start and end month/day/year values and are:

"field_date[rrule][FREQ]" => "NONE",
"field_date[rrule][UNTIL][tz]" => 'America/New_York',
"field_date[rrule][UNTIL][all_day]" => 1,
"field_date[rrule][UNTIL][granularity]" => 'a:3:{i:0;s:4:"year";i:1;s:5:"month";i:2;s:3:"day";}',
"field_date[rrule][exceptions][EXDATE][0][tz]" => 'America/New_York',
"field_date[rrule][exceptions][EXDATE][0][all_day]" => 1,
"field_date[rrule][exceptions][EXDATE][0][granularity]" => 'a:3:{i:0;s:4:"year";i:1;s:5:"month";i:2;s:3:"day";}',
"field_date[rrule][additions][RDATE][0][tz]" => 'America/New_York',
"field_date[rrule][additions][RDATE][0][granularity]" =>'a:3:{i:0;s:4:"year";i:1;s:5:"month";i:2;s:3:"day";}'

All of which were found in the POST values sent when manually saving one of these nodes both with and without changes.

I've been banging my head against the wall on this one for a couple of days now. Can anyone tell me what I'm doing wrong?

Thank you.

Tags : fields


Answers 2


All the CCK fields has access rights settings in actions-roles permission matrix. Normally the access is restricted. Please confirm the permission on date field for your role.

An illegal choice has been detected. Please contact the site administrator. is normally reported when some extra fields are added to the form which are not originally the part of form. It is a security measure from Drupal core.

I do not know how cURL request cycle maintains user session that should be associative with proper role that is allowed to edit date field.

Shuaib Nawaz
Shuaib Nawaz
June 15, 2011 06:30 AM

The problem was ultimately quite trivial, the values I was submitting as field_date[value][day] and field_date[value][month] were always 2 digits (I was just exploding a date straight out of mysql), so anything that occurred after the 9th of Oct - Dec was fine but anything prior to that was invalid.

nsf81
nsf81
June 16, 2011 00:48 AM

Related Questions



How would I create conditional fields on install?

Updated October 13, 2016 09:03 AM


D8 - edit fields on display node

Updated March 05, 2018 22:07 PM