Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

You can use the Rules module to get this logic implemented. Have a look at my answer to "http"https://drupal.stackexchange.com/questions/159293/how-to-set-the-values-of-some-fields-depending-on-the-value-of-a-list-box/192904#192904".

The rule shown there uses these fields:

  • a selection list field with machine name field_optionlist (corresponds to your field 1).
  • a text field with machine name field_free_format_text (corresponds to your field 2).

If you adapt the machine names in that rule (in Rules export format) to the names from your 2 fields, should be straight forward to further tune (customize) it to also match the values as in your case.

However, to make this to work with only 1 rule (instead of writing 3 rules, ie one for each possible value of field 1, so one for "A", one for "B" and one for "C"), you also need the "Conditional Rules module. That way you could expand the prototype to say dozens of different possible values. For an example using the Rules Conditional module (for which there is not a lot of docu available), refer to my answer to the question "http"https://drupal.stackexchange.com/questions/114955/how-to-prevent-a-node-being-saved-when-using-the-rules-module/178623#178623".

Best practice advise: the more you start using the Rules module, the more you should try to group rules together using the Rules Conditional module. Just to keep the entire set of rules manage-able (eg to have related business logic shown on a single Rule UI screen). A good sample of how easy it is to end up with a lot of rules, is what you can see in the Answers module (current 7.x-4.x-rc2 version):

You can use the Rules module to get this logic implemented. Have a look at my answer to "http://drupal.stackexchange.com/questions/159293/how-to-set-the-values-of-some-fields-depending-on-the-value-of-a-list-box/192904#192904".

The rule shown there uses these fields:

  • a selection list field with machine name field_optionlist (corresponds to your field 1).
  • a text field with machine name field_free_format_text (corresponds to your field 2).

If you adapt the machine names in that rule (in Rules export format) to the names from your 2 fields, should be straight forward to further tune (customize) it to also match the values as in your case.

However, to make this to work with only 1 rule (instead of writing 3 rules, ie one for each possible value of field 1, so one for "A", one for "B" and one for "C"), you also need the "Conditional Rules module. That way you could expand the prototype to say dozens of different possible values. For an example using the Rules Conditional module (for which there is not a lot of docu available), refer to my answer to the question "http://drupal.stackexchange.com/questions/114955/how-to-prevent-a-node-being-saved-when-using-the-rules-module/178623#178623".

Best practice advise: the more you start using the Rules module, the more you should try to group rules together using the Rules Conditional module. Just to keep the entire set of rules manage-able (eg to have related business logic shown on a single Rule UI screen). A good sample of how easy it is to end up with a lot of rules, is what you can see in the Answers module (current 7.x-4.x-rc2 version):

You can use the Rules module to get this logic implemented. Have a look at my answer to "https://drupal.stackexchange.com/questions/159293/how-to-set-the-values-of-some-fields-depending-on-the-value-of-a-list-box/192904#192904".

The rule shown there uses these fields:

  • a selection list field with machine name field_optionlist (corresponds to your field 1).
  • a text field with machine name field_free_format_text (corresponds to your field 2).

If you adapt the machine names in that rule (in Rules export format) to the names from your 2 fields, should be straight forward to further tune (customize) it to also match the values as in your case.

However, to make this to work with only 1 rule (instead of writing 3 rules, ie one for each possible value of field 1, so one for "A", one for "B" and one for "C"), you also need the "Conditional Rules module. That way you could expand the prototype to say dozens of different possible values. For an example using the Rules Conditional module (for which there is not a lot of docu available), refer to my answer to the question "https://drupal.stackexchange.com/questions/114955/how-to-prevent-a-node-being-saved-when-using-the-rules-module/178623#178623".

Best practice advise: the more you start using the Rules module, the more you should try to group rules together using the Rules Conditional module. Just to keep the entire set of rules manage-able (eg to have related business logic shown on a single Rule UI screen). A good sample of how easy it is to end up with a lot of rules, is what you can see in the Answers module (current 7.x-4.x-rc2 version):

Add Conditional Rules module
Source Link
Pierre.Vriens
  • 36k
  • 40
  • 50
  • 182

You can use the Rules module to get this logic implemented. Have a look at my answer to "http://drupal.stackexchange.com/questions/159293/how-to-set-the-values-of-some-fields-depending-on-the-value-of-a-list-box/192904#192904".

The rule shown there uses these fields:

  • a selection list field with machine name field_optionlist (corresponds to your field 1).
  • a text field with machine name field_free_format_text (corresponds to your field 2).

If you adapt the machine names in that rule (in Rules export format) to the names from your 2 fields, should be straight forward to further tune (customize) it to also match the values as in your case.

However, to make this to work with only 1 rule (instead of writing 3 rules, ie one for each possible value of field 1, so one for "A", one for "B" and one for "C"), you also need the "Conditional Rules module. That way you could expand the prototype to say dozens of different possible values. For an example using the Rules Conditional module (for which there is not a lot of docu available), refer to my answer to the question "http://drupal.stackexchange.com/questions/114955/how-to-prevent-a-node-being-saved-when-using-the-rules-module/178623#178623".

Best practice advise: the more you start using the Rules module, the more you should try to group rules together using the Rules Conditional module. Just to keep the entire set of rules manage-able (eg to have related business logic shown on a single Rule UI screen). A good sample of how easy it is to end up with a lot of rules, is what you can see in the Answers module (current 7.x-4.x-rc2 version):

You can use the Rules module to get this logic implemented. Have a look at my answer to "http://drupal.stackexchange.com/questions/159293/how-to-set-the-values-of-some-fields-depending-on-the-value-of-a-list-box/192904#192904".

The rule shown there uses these fields:

  • a selection list field with machine name field_optionlist (corresponds to your field 1).
  • a text field with machine name field_free_format_text (corresponds to your field 2).

If you adapt the machine names in that rule (in Rules export format) to the names from your 2 fields, should be straight forward to further tune (customize) it to also match the values as in your case.

You can use the Rules module to get this logic implemented. Have a look at my answer to "http://drupal.stackexchange.com/questions/159293/how-to-set-the-values-of-some-fields-depending-on-the-value-of-a-list-box/192904#192904".

The rule shown there uses these fields:

  • a selection list field with machine name field_optionlist (corresponds to your field 1).
  • a text field with machine name field_free_format_text (corresponds to your field 2).

If you adapt the machine names in that rule (in Rules export format) to the names from your 2 fields, should be straight forward to further tune (customize) it to also match the values as in your case.

However, to make this to work with only 1 rule (instead of writing 3 rules, ie one for each possible value of field 1, so one for "A", one for "B" and one for "C"), you also need the "Conditional Rules module. That way you could expand the prototype to say dozens of different possible values. For an example using the Rules Conditional module (for which there is not a lot of docu available), refer to my answer to the question "http://drupal.stackexchange.com/questions/114955/how-to-prevent-a-node-being-saved-when-using-the-rules-module/178623#178623".

Best practice advise: the more you start using the Rules module, the more you should try to group rules together using the Rules Conditional module. Just to keep the entire set of rules manage-able (eg to have related business logic shown on a single Rule UI screen). A good sample of how easy it is to end up with a lot of rules, is what you can see in the Answers module (current 7.x-4.x-rc2 version):

Source Link
Pierre.Vriens
  • 36k
  • 40
  • 50
  • 182

You can use the Rules module to get this logic implemented. Have a look at my answer to "http://drupal.stackexchange.com/questions/159293/how-to-set-the-values-of-some-fields-depending-on-the-value-of-a-list-box/192904#192904".

The rule shown there uses these fields:

  • a selection list field with machine name field_optionlist (corresponds to your field 1).
  • a text field with machine name field_free_format_text (corresponds to your field 2).

If you adapt the machine names in that rule (in Rules export format) to the names from your 2 fields, should be straight forward to further tune (customize) it to also match the values as in your case.