I am trying to use triggers to evaluate whether or not certain checkboxes are set.
Under certain combinations, they should not be allowed to save the post.
In trying to figure out how to do this I used the "Content is going to be saved" with the "Show a configurable message on the site", with the "display as error message" option selected.
What doesn't happen is that an actual error is not triggered and so the form will be saved.
I am trying to prevent the form from being saved.
I also have triggers waiting on "After saving new content", of which I do not want to fire and therefore canceling a post save would be desirable.
Is there an existing way to do this?
Shouldn't the "Display as error message" option from "Show a configurable message on the site" do this while under the "Content is going to be saved" trigger?
If the above two questions are answered with no, then this is a feature request to add a "Cancel Post" action to be available for the "Content is going to be saved" trigger.
Comments
Comment #1
Manonline commentedsubscribe!
Comment #2
mitchell commented>> "Cancel post" action
The rules forms module has a 'set form error' action. I believe that is what you are looking for, but I haven't tried it yet.
Another idea would be to automatically flag these nodes as 'draft' or something. If the values are okay, then unflag it. If the values need to be fixed, then it can still be saved but it will remain flagged. In your existing views and rules where they are filtered by 'node is published,' you can add a condition that it is not flagged as a draft. This adds a workflow to your validation scheme which may or may not be useful.
Comment #3
thekevinday commentedBy "set form error", do you mean: "display as error message"?
I mentioned that this is already set and the the form still gets saved even though an error message is shown.
That would make this a bug report.
If by "set form error" you mean there is an action called "set form error", well then I have a problem as that "set form error" is not appearing in my list of possible actions.
That would also make this a bug report.
As far as your "idea":
The purpose of the error message is to prevent a user from filling out a form until all conflicting options are resolved.
Having the form get saved cannot be allowed.
Here is an example.
Lets say I have a form with two check boxes:
1) Pay by Credit Card
2) Pay Check
Only one of these may be selected at a time, and check boxes are explicitly requested by the client (who flips the bill).
I simply have to have trigger say "No, you cannot continue because..".
If I have some extra person have to handle a draft, I would:
1) have to convince a paying client to hire an extra person to sit down and do something that the form's entire purpose was to automate
2) have the client contact the person who filled out the form and say, "Oh and by the way as you did not properly fill out your form, that automated receipt is invalid until you tell us which way you are going to pay" (assuming the are able to contact the person who filled out the form).
Comment #4
fago>I mentioned that this is already set and the the form still gets saved even though an error message is shown.
No, he is referring to the rules-forms integration.
Comment #5
thekevinday commentedThanks for the clarification.
Now, I am looking all over for this rules-form integration option that you are talking about and I am not find it.
Where should I be looking?
I am not seeing an any sort of rules-form nor any "set form error" option under the rules "actions".I looked under the "Actions are not configurable" area and found it there:
So, I have been unable to find it because it is not being allowed for some reason..
In fact, the entire rules form module seems to be set as unavailable.
FYI: all rules modules except simpletest are enabled.
Comment #6
lolmaus commentedDid you add the Form argument to your ruleset?
Comment #7
thekevinday commentedI am not using Rule Sets at this time.
I am using Triggered Rules -> Active Rules.
Comment #8
lolmaus commentedI believe what you are going to do should be done with Rules Forms.
But i failed too. Here's my issue: http://drupal.org/node/596230
Comment #9
benone commentedthekevinday: Did you find out how to do it ?
Comment #10
thekevinday commentedWith the latest versions on a clean server I can now make this appear.
The Rule set was created with the Form and Form State as rule set parameters, and then I could make a rule that follows this rule set.
Comment #11
mitchell commentedFixed according to #10.
Tutorial 5: Editorial workflow with Rules is the only documentation page with rules forms info. Please start a new page for rules forms if you have something to share.
Comment #12
benone commentedEasiest solution is to use a 'Page redirect' action with 'Immediately issue the page redirect' checked.
I use it with 'Show a configurable message on the site' and no forms, arguments, etc... are needed.
Hope this helps.