Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I needed a rule to fire anytime a certain field is changed. The usual approach with Rules is to fire on "Content changed" and compare the field values to check if they changed. However, Editable Fields doesn't call the node_save() sequence.
I think proper support would be to have a Rules event to fire anytime a field is updated.
Comment | File | Size | Author |
---|---|---|---|
#14 | Screen Shot 2013-09-05 at 10.51.50.png | 82.25 KB | vaccinemedia |
Comments
Comment #1
jdlind38 CreditAttribution: jdlind38 commented+1. I agree with Fabian
Comment #2
franzI think you meant Franz, Fabian is Fabianx
Comment #3
Maedi CreditAttribution: Maedi commented+1 but does anyone know of current workarounds to this problem? Perhaps a hook that triggers node_save() in the background via the AJAX request?
Comment #4
charlie-s CreditAttribution: charlie-s commentedI am currently firing off lots of rules on "After updating existing content" via an Editablefield and comparing the node-unchanged and node. Are you folks not able to get this to work? This is with dev.
Comment #5
ilyasmdgh CreditAttribution: ilyasmdgh commentedI tried with 7.x-1.x-dev . After updating existing content does not trigger with editable fields.
The field is a list for selecting a simple yes or no.
The action I use is page redirect for testing. This does not work for me.
Can you please help me with this. How actually are you using it with the comparisons
Comment #6
presleyd CreditAttribution: presleyd commentedTest this with a different action to confirm that your action settings aren't at fault. I made a simple rule just now triggered off of an update to existing content and a single condition (that it was of a certain content type). The action I used for testing was to send me an email. Toggling both an autocomplete field as well as a text select list seemed to trigger fine.
Comment #7
ilyasmdgh CreditAttribution: ilyasmdgh commentedThanks for the reply.
I did a simple 'set data value' as the action, and yes it did trigger it. I also tried with 'send an email'.
The problem I faced is that this rule is triggered after moving away from the page or page reload.
I guess this is how it is supposed to work.
What I require was to trigger the rule as and when the field was saved on the same page for my workflow to work. Please help if you think i am missing something here.
Comment #8
presleyd CreditAttribution: presleyd commentedIf I'm understanding what you are saying: You are trying to change one field's value and cause it to update the value of another field in the node that you are viewing?
If so, the rule is actually triggered immediately. Your action is only noticeable on a page reload because the 'set data value' doesn't asynchronously refresh the field on the page you are viewing. You could, of course, refresh the whole page with a rules action but that's probably not what you're after. Nor can I think of a good way of doing this without custom javascript.
Comment #9
zdean CreditAttribution: zdean commentedI would be ok with a "refresh" action, but I don't see that action available in Rules. Am I overlooking something?
Comment #10
presleyd CreditAttribution: presleyd commentedSystem->Page redirect used to work in 6 if you selected to option to immediately issue the refresh, I just realized this option is no longer in Rules for Drupal 7. I suppose a PHP snippet would work if you have PHP filters enabled.
Comment #11
zdean CreditAttribution: zdean commentedThanks...I'll look for a snippet and paste back here if I come across something. If anyone here knows the snippet to use, it would be appreciated!
Comment #12
zdean CreditAttribution: zdean commentedI've had no luck with this...wondering if anyone can provide some direction on the snippet that could be used.
thanks!
Comment #13
koppie CreditAttribution: koppie commentedAt this point (a year later), it looks like editablefields properly triggers the "after updating existing content" event.
Comment #14
vaccinemedia CreditAttribution: vaccinemedia commentedHi Guys, hope you don't mind me re-opening this one. I have the dev version of editable fields and Rules 2.3. I have created a view which due to the design has to be in a block which contains editable fields. On changing the values the rule I have set for the event of "After updating existing content" is not triggering a redirect action.
The values which are being edited change the CSS which styles them and so a refresh is required when changing the values in order to change their styles or else the user does not know for sure if the values have changed or not without refreshing the page. So what I'm trying to do is "redirect" to the current page in order to do the page refresh on updating the editable fields. See attached image.
Could this be because I'm using a view?
Comment #15
vaccinemedia CreditAttribution: vaccinemedia commentedUpdate: simply viewing the node (i.e. normal node view, not a views view) does not trigger the rule when editing fields on the page. The rule is functioning correctly though. Editing the node does trigger the redirect on saving it.
Comment #16
thommyboy CreditAttribution: thommyboy commentedsame here (on D6). to make it more clear what I experience:
- i do have a RADIO set to "editable" in a view
- i have a rule that does display a message if this radio is set to a given value
editing the node the "normal way" does trigger the rule
editing the node via editable fields/ the view is behaving strange- setting the radio does display the ajax animation showing that something is saved but the rule doe not trigger. clicking the SAME radio AGAIN does fire the rule
Comment #17
Sata CreditAttribution: Sata commented--disregard, this is meant for editableviews module.
Comment #18
mrweiner CreditAttribution: mrweiner commentedThis issue seems to be present in the current version for D7 when updating an entity reference field on a commerce line item. Changing the value does not trigger my rules that are set to trigger on entity update.
Comment #19
Cayenne CreditAttribution: Cayenne as a volunteer commentedto #18 and others.
While the update hook seems not to fire when I'm editing from a view, the rule does fire, at least for the entityforms which I am modifying using editablefields in a view.