I'm trying to implement "Modify entity values" to update a field value. I'm running into a road block when images are required in the content type. Instead of updating the node, I'm getting an error that the image field is required. I went into my content type and unchecked require field and the action performs as it should.

It appears that this has been addressed here http://drupal.org/node/1057158#comment-5487060, so I'm not sure why this isn't working.

Comments

timnash’s picture

I'm having the exact same issue here. Image field is required, and I'm trying to update a different field in the same content type. I get "Image field is required." warning message.

timnash’s picture

OK, Here's the fix for this. Sorry, don't have time to make up a patch.

At line 200 in actions/modify.action.inc, there is a piece of code that sets #access = false then a piece of code that unsets required on all fields. Just swap these around (so it unsets required first) and then it will work fine.

bojanz’s picture

Hm, that's odd, I don't see why the solution in #2 should make a difference (you end up with the same $form structure either way).

EDIT: Sorry, was tired when I wrote this, ignored the "continue" in code. I'll post a patch.

bojanz’s picture

Title: "Modify entity values" not working with required images » "Modify entity values" not setting #required => FALSE for hidden fields
Status: Active » Fixed

Committed a fix.

cjacobsen’s picture

Thanks for the patch! I installed the latest dev release and it's working.

Status: Fixed » Closed (fixed)

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

nicholasThompson’s picture

Dev works for me too.

dhalbert’s picture

Status: Closed (fixed) » Active

I am seeing this problem for a Date field, even with the latest VBO dev which has the fix mentioned above.

I am trying to modify just the Body field of a node that also has a Date field and I'm getting an error: "A valid date is required for Event Date/Time Start date." The field (named "Event Date/Time") is required and has a non-required End date.

There are other fields in the node content type that are not Dates, are required, and don't cause this problem.

If I choose both the Date field and the body and give them values, the modification proceeds just fine. Or if I make the Date field not required, that also works, as I'd expect.

So I think this problem may be peculiar to Date fields, but I'm not sure whether it's a bug in Date or an idiosyncrasy of Date with respect to VBO that VBO should handle. I haven't submitted a bug report to Date yet. Enlightenment welcomed.

AaronBauman’s picture

Bojanz: can you share the fix from #4 and I can try to come up with a patch for date fields, or figure out if this is actually an issue for Date module?

bojanz’s picture

Status: Active » Closed (fixed)

http://drupalcode.org/project/views_bulk_operations.git/commitdiff/0b1bfcf

The original issue was fixed, so I'm reclosing this.
If you have additional fixes specific for Date, open a new issue.