Idea: Allow user to choose between direct input and variable assignment

Events happening in the community are now at Drupal community events on www.drupal.org.
fago's picture

When doing the rules integration this question often arises when one adds a new data type:

Should the data type, when used as argument, make use of an direct input form or should it be assigned by a state variable?

So often there are pros and cons for both approach, e.g. for flag and taxonomy terms. Direct input is easier to use, but the variable assignment is together with an loading action a bit more powerful. So to solve this, the idea is to allow the user to choose between direct input and the variable assignment. Note, that this won't be ready for 1.0 for sure.

Some implementation thoughts:

  • On API level it should work as it is now.
  • When the variable assignment select is displayed, add an option "Use direct input method"
  • When the direct input method is used, display a link "Use existing variable" or maybe an icon?
  • Without javascript, display both and use the variable assignment, except when "Use direct input method" is chosen.
  • With javascript, always display only one form field and hide the other. Set the variable assignment to "Use direct input method" when it's hidden.

Some questions:

  • Should data types say whether the default is the input form or it should it be set per argument? I think a default per data type should suffice.
  • What are the best texts? Is this easy enough to understand for users?
  • Should we use an icon for the "Use existing variable" link?

Thanks go to jpetso for his help figuring out this solution.. :)

Comments

I prefer 'variable

amitaibu's picture

I prefer 'variable assignment' although the above suggestion gave me another Idea. First I'll explain why I prefer variable assignment, using the flag example. Image this configuration (which isn't yet possible in Flag):
1) Load flag called 'Bookmarks'.
2) Flag a node
3) Trim flag.

cons - I need to add another action to load the flag. pros - If I want to change the flag from 'Bookmarks' to 'My favorite' I need to do it in a single place (in the load action), and not in the other actions.
You could argue that I can do the same with the above suggestion - simply mark the "Use variable assignment", but I think that Rules should help the users prepare the configurations with less risk of mistakes and with as little UI clutter as possible.

However, the direct input can be used in the 'Load' action itself - we can have a list of flags + another field for free text (e.g. token, php).

both?

fago's picture

The question was not 'variable assignment' vs 'direct input' - the idea was about making both possible, so the user can choose. I hope, you got that right now :)

So the idea allows you to configure it that way, without forcing you to do so. I think for making rules easy to use it's critical to not force them to load a new variable to be able to do something. This way, we can make it easy to get into it while keeping the ability to do it with variables.

Yeah, I understood it but at

amitaibu's picture

Yeah, I understood it but at the beginning I though it might be confusing however, after re-thinking, I agree it's a good idea :)

Ok, I was 'sleeping' on this

amitaibu's picture

Ok, I was 'sleeping' on this idea - and I like it :) I understood its value by the http://drupal.org/node/407028 example.

i like this

Ariesto's picture

I agree that having both ways is helpful, providing we have documentation that describes the pros and cons of each method to a Newbie like me. Maybe this summer I can try to integrate the advanced help module into rules.

Fago, I don't understand your second question about the "what are the best texts". Are you referring to this concept as a whole or the two types described above, or something else entirely?

As long as people can understand what the icon means, then I'd say an icon is better than text. The icon would also help differentiate the choice the user is making from all the other text choices on the screen.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week