I'm attempting to use Blockreference with the autocomplete widget. The failure is threefold:

1. When attempting to use the autocomplete widget, single value, submission of a node fails because of a call to db_fetch_object in line 377.

2. If line 377 is fixed to $result->fetchObject() rather than db_fetch_object($result), the node will validate and save; however, the value saved is incorrect. All but the first digit of the bid are stripped, so bid:43 and bid:412 are both saved as bid:4.

3. When attempting to use the autocomplete widget with unlimited numbers of items, an attempt to save or to add another item results in a string of errors such as this:

https://gist.github.com/1b8bc3538eb4abd87556

Note that 'Foobar' was the name of the blockreference field I created to test this.

This is using version Blockreference 7.x-1.5. Drupal is up-to-date, 7.0. No other contrib or custom modules are installed.

Comments

zroger’s picture

Status: Active » Needs review
StatusFileSize
new2.09 KB

Here's a patch that fixes both issues.

To fix the validation issue, I re-worked the blockreference_autocomplete_validate() function to be more like the nodereference equivalent.

To fix the saving issue, I had to wrap the nodereference form element in an array indexed with 'bid'. Again, this follows what nodereference does.

I have tested this solution with single and multiple versions of both the autocomplete and the sortable select widgets.

timcosgrove’s picture

Status: Needs review » Reviewed & tested by the community

I have installed the patch and it's working beautifully.

danielb’s picture

Status: Reviewed & tested by the community » Fixed

cheers

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.