Don't know if this is a bug with the Rules Forms module, or something off in my own site configuration. The variables for form submission data in PHP Evaluation (example $textfield:submitted:name) just don't work for me. I couldn't get 'Form Element Has Value' in actions to work either: I was able to select the correct field on the correct form, but it always evaluated false (possibly because submission data wasn't being passed to Rules for comparison). Has anyone else experienced this?
I'm saying it might be something in my configuration because I tried Webform Rules as well, and its tokens for submitted data were broken, but I was able to get submission data out of one of its PHP variables.
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | rules-forms.png | 48.12 KB | globexplorer |
Comments
Comment #1
jordojuice commentedWhat exactly are you trying to accomplish? And what exactly do you mean by "don't work"?
The variables that are passed to Rules by Rules Forms are not actually form elements, though you just gave me a great idea. Those variables are actually just strings that reference elements in a form. Rules forms uses the string to find the location of the element within
$form. The new way of handling form elements is only a few weeks old, so it does need some work. I think what I may do is write a small class that extends ArrayObject to handle form elements. Instead of passing element IDs (which look like textfield:something:title, where the string before the first colon is the field type and the rest is the hierarchical position of the element in a form). We can use a class to wrap form elements and actually pass them to Rules. It shouldn't cost much more, and it will ultimately reduce some code elsewhere. Objects will maintain references to the $form array, and php evaluation will be able to alter form elements directly.Even better would be to explore using chained variables available in Rules 2!
I'll get back to you on this, but I tend to code fast and put together major patches quickly when I have a good idea.
Comment #2
Patribus commentedHello,
I'm having the same problem.
Using the available / proposed variables within rules, for instances when editing fields of the action "Send mail", give php error
Something like
works phine, but using variables including ':' give error.
So,
gives the following error
Some Bug? Missing something?
Cheers
Pat
PS: well wrote this comment to quickly and read just afterwards carefully the last comment. So my question ist, how to overcome this problem. Which alternatives are there?
Comment #3
axxint commentedI was trying to send emails out to different set addresses based on what was selected in a form drop-down.
By "don't work", I mean I was able to set up a test rule that was triggered based on values from non-from elements (like user or date submitted), but when I tried to use values from any of the form elements, the rule wasn't getting triggered. I had been thinking that Rules Forms could write and read values from/to each form field, but since this doesn't seem to be the case, it makes sense that what I was trying to do wasn't working.
I was able to solve my need by just putting together an options list that had the value of each selection as the email I wanted to associate with that selection. Then in the normal webform backend I set up an email to go out with that form element set as the email addressee. I had been trying rules-based solutions because we initially wanted to dynamically populate that select list, but settled for the aforementioned solution because dev time was short.
I'm glad to hear my fumblings may have inspired something new! Thanks!
Comment #4
axxint commentedComment #5
Patribus commentedJust an aditional comment:
if I understood it correctly, the problem are the colons in variables formated like
$textfield:something:titlewhich are not correctly evaluated, since this format is not accepted by the actual evaluation process.
Did I understood this correctly?
The point is, how do I get to my variables / fields, which should be available trough / to the rules actions?
Comment #6
Patribus commentedsome news about this issue?
Comment #7
honza pobořil commentedSame problem
Comment #8
amitsedaiz commentedSame Problem of not being able to execute/display variables having a colon ":"
Comment #9
dca123 commentedSame problem #5
Comment #10
Anonymous (not verified) commentedSame problem
Comment #11
Anonymous (not verified) commentedYou can solve it by printing the component values manually:
<?php print render($form['submitted']['component']['#value']);?>Replace "component" with the machine-name of the form-item.
EDIT: sorry, this only applies to a webform. That was the node in my case :).
Comment #12
globexplorer commentedHi Guys!
This is not really an issue, because you can make use of the $form and $form_state variable.
Ignore the variables. You do not need them. See the attached screen shot for an example.
Have fun with that great feature. Thanks for that great module!
Comment #13
caminadaf commentedClosing based on the comment above