It works when creating.

The problem, I think, is in the params received by function publicbookings_ajax_query
from Apache log:

[Wed Aug 11 10:55:26 2010] [error] , referer: http://biomolbs/publicbookings/request/1/update
[Wed Aug 11 10:55:39 2010] [error] Array\n(\n [resource_id] => 3\n [record_id] => 0\n [start] => 2010-08-11 11:00:00\n [end] => 2010-08-11 11:00:00\n)\n, referer: http://biomolbs/publicbookings/request/add
[Wed Aug 11 10:57:30 2010] [error] , referer: http://biomolbs/admin/content/publicbookings/booking/1/edit

[Done with

function publicbookings_ajax_query() {
$params = publicbookings_ajax_post_prepare();
error_log(print_r($params, true));
[...]
}
]

Comments

rodrigobb’s picture

As I suspected the problem is in the disabled resource field.

When a form is submitted, disabled fields are not send and resource_id is a mandatory field. I'm trying to fix it.

rodrigobb’s picture

FIX:

In ajax.js function check_availability you should enable resource_id to be serialized in serializeArray.

Just have to add two lines of code

  $('#edit-resource-id').removeAttr('disabled');
  fields = $('#edit-resource-id, #edit-record-id, #edit-start-wrapper [name], #edit-end-wrapper [name], .date-clear [name]').serializeArray();
  $('#edit-resource-id').attr('disabled', 'disabled');

EDIT:
Previous fix had a bug. Should be

  var redisable = $('#edit-resource-id').attr('disabled');
  if (redisable) {
    $('#edit-resource-id').removeAttr('disabled');
  }
  fields = $('#edit-resource-id, #edit-record-id, #edit-start-wrapper [name], #edit-end-wrapper [name], .date-clear [name]').serializeArray();
  if (redisable) {
    $('#edit-resource-id').attr('disabled', 'disabled');
  }