2

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.

  • Do you have access to the database via phpmyadmin to make your updates there in SQL ? – tostinni Jun 15 '11 at 6:03
1

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.

  • cURL stores cookies, php.net/manual/en/function.curl-setopt.php, CURLOPT_COOKIEJAR and CURLOPT_COOKIE are the options to use. One thing I learned while trying to debug this is that you can reuse the same form_token for multiple posts, I had assumed it was a nonce. – nsf81 Jun 16 '11 at 0:58
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.