Answers.Body: <p>Webform does not include conditionally hidden components in the submission. Civi Core treats a Null for installments as "Open Ended Recurring". So with submitting nothing, it will always be a recurring contribution. </p>
  
  <p>The only option I can come up with is to not hide the installments option. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T19:04:15.857Z
Answers.Text: The issue is that you have changed the Widget of the field from its default: Number; You changed it to a Select - changing widgets can have unintended consequences.
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T22:02:06.283Z
Answers.Text: I behaves in exactly the same manner if I have the Widget as a Number or as a Select Option. My answer here is still the correct answer for this. Once it is not shown via conditionals, the code overrides your set default or conditional "set to" and makes it an unending recurring.
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T17:29:28.753Z
Answers.LastActivityDate: 2020-02-27T03:16:43.453Z
Answers.LastEditDate: 2020-02-27T03:16:43.453Z
Answers.UserDisplayName: Iowa Boy
Answers.Body: <p>You need to set a conditional to ensure instalments = 1 for the one time scenario. Instalments = 0 is open ended recurring and any other number is recurring with that number of instalments.</p>
  
  <p>There was a change/PR to the repo that enabled open ended recurring contributions: <a href="https://github.com/colemanw/webform_civicrm/pull/141" rel="nofollow noreferrer">https://github.com/colemanw/webform_civicrm/pull/141</a>
  so now it's even more important than before to ensure <code>civicrm_1_contribution_1_contribution_installments</code> is a number and set properly. It's a Number --> No is not a valid value. </p>
  
  <p>Best to keep the Widget: Number -> this is how the component config looks when it's first enabled:</p>
  
  <p><a href="https://i.sstatic.net/4oFyF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4oFyF.png" alt="enter image description here"></a></p>
  
  <p>If you want to hide the Element -> change the widget to Hidden and use conditionals to set its value to either 0 or 1 (based on another field).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T06:23:05.873Z
Answers.Text: My webform question for "I want this to Recur Monthly" has the form key civicrm_1_contribution_1_contribution_installments with the Options default set to Key = 1 Value = No And than I also have the conditional to set that answer to No. Maybe I need to try 1 instead of No?
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T06:32:28.420Z
Answers.Text: I just changed my conditional so that it sets that to 1. I ran a donation and it created a recurring contribution.
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T07:00:03.383Z
Answers.Text: I also unchecked Required for the installments. I tested it again and it still created a recurring contribution. I looked in the tables and the default there is 1 and the Conditional is to set that to 1 as well. So the tables seem to have the right data. The weird thing is that it used to work properly.
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T16:31:44.107Z
Answers.Text: I've added some more detail in the Answer. It' important that civicrm_1_contribution_1_contribution_installments is a number
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T16:44:13.247Z
Answers.Text: I have the Key for civicrm_1_contribution_1_contribution_installments as a number (default is 1).  I will edit my question to make it more clear what I am asking.
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T21:49:22.320Z
Answers.Text: I have been using it with the Widget as a Select Option on all my forms for more than a year now. I just switched it back to a Number with default 1. It behaves in exactly the same manner. It changes my 1 to a 0 on submission. My answer below is the correct. You cannot use a conditional to hide it unless you want all the submissions to be indefinitely recurring.
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-26T04:46:26.770Z
Answers.LastActivityDate: 2020-02-27T05:00:44.530Z
Answers.LastEditDate: 2020-02-27T05:00:44.530Z
Answers.UserDisplayName: KarinG - Semper IT
Body: <p>CiviCRM 5.20.0
  Drupal 7.69
  iATSPayments 1.7.1
  Webform/Civi Integration 7.x-4.28</p>
  
  <p><a href="https://secure.radiusinternational.org/reimbursement/" rel="nofollow noreferrer">This webform</a> is used for non-taxdeductible giving. I have two categories set at the top of the form, giving for food and lodging while visiting campus and assisting our short-term volunteers with the cost of their food and lodging. Often donors will want to set up a monthly recurring if they are assisting with our our volunteers food and lodging. But visitors do not want/need to have monthly recurring just for a visit to campus.
  So, I used conditionals to only show the parts needed for the option they start with. If they choose to give to food and lodging, then I do not show "I want this to recur monthly" and I have Recurring monthly default set to no. But all giving to this is created as a recurring contribution. You can select "Payment for short-term staff room and board" and it shows the "I want this to Recur" with the default of NO and if you leave it on No, it does not create it as recurring.</p>
  
  <p>I changed my conditional for the first option so that "I want this to Recur" is set to No. But I get the same results. It creates all contributions for this option as recurring. </p>
  
  <p>Additional info:<a href="https://i.sstatic.net/y3b6y.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/y3b6y.png" alt="enter image description here"></a>
  The attached screenshot shows how I have Options set for civicrm_1_contribution_1_contribution_installments so it sends it as a number. The Value is what the consumer sees visually, the Key is the number that gets sent to civicrm_contributions_installments. It is obviously sending it as a number because it does work for the second option when people give to cover room and board for volunteers, with that they can choose to have it recur or not recur. There is only one civicrm_1_contribution_1_contribution_installments on my form so both options are using the same installments question. </p>
  
  <p>The problem is, it is overriding my default = 1 AND my conditional to set civicrm_1_contribution_1_contribution_installments to 1. It is putting it in the installments column with a 0. But only for the first option of the form, the second option is working as designed.</p>
  
Tags: <webform-civicrm><iatspayments>
Title: All contributions on this webform are created as recurring
ThreadText: # All contributions on this webform are created as recurring
  
  (Asked by: username_0 on 2020-02-26)
  
  CiviCRM 5.20.0
  Drupal 7.69
  iATSPayments 1.7.1
  Webform/Civi Integration 7.x-4.28
  
  [This webform](https://secure.radiusinternational.org/reimbursement/) is used for non-taxdeductible giving. I have two categories set at the top of the form, giving for food and lodging while visiting campus and assisting our short-term volunteers with the cost of their food and lodging. Often donors will want to set up a monthly recurring if they are assisting with our our volunteers food and lodging. But visitors do not want/need to have monthly recurring just for a visit to campus.
  So, I used conditionals to only show the parts needed for the option they start with. If they choose to give to food and lodging, then I do not show "I want this to recur monthly" and I have Recurring monthly default set to no. But all giving to this is created as a recurring contribution. You can select "Payment for short-term staff room and board" and it shows the "I want this to Recur" with the default of NO and if you leave it on No, it does not create it as recurring.
  
  I changed my conditional for the first option so that "I want this to Recur" is set to No. But I get the same results. It creates all contributions for this option as recurring.
  
  Additional info:[![enter image description here](https://i.sstatic.net/y3b6y.png)](https://i.sstatic.net/y3b6y.png)
  The attached screenshot shows how I have Options set for civicrm\_1\_contribution\_1\_contribution\_installments so it sends it as a number. The Value is what the consumer sees visually, the Key is the number that gets sent to civicrm\_contributions\_installments. It is obviously sending it as a number because it does work for the second option when people give to cover room and board for volunteers, with that they can choose to have it recur or not recur. There is only one civicrm\_1\_contribution\_1\_contribution\_installments on my form so both options are using the same installments question.
  
  The problem is, it is overriding my default = 1 AND my conditional to set civicrm\_1\_contribution\_1\_contribution\_installments to 1. It is putting it in the installments column with a 0. But only for the first option of the form, the second option is working as designed.
  
  **Tags:** webform-civicrm, iatspayments
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-02-26. Score: 0 | Accepted answer
  
  Webform does not include conditionally hidden components in the submission. Civi Core treats a Null for installments as "Open Ended Recurring". So with submitting nothing, it will always be a recurring contribution.
  
  The only option I can come up with is to not hide the installments option.
  
  > **Comments:**
  > **username_1**: The issue is that you have changed the Widget of the field from its default: Number; You changed it to a Select - changing widgets can have unintended consequences.  
  > **username_0**: I behaves in exactly the same manner if I have the Widget as a Number or as a Select Option. My answer here is still the correct answer for this. Once it is not shown via conditionals, the code overrides your set default or conditional "set to" and makes it an unending recurring.  
  
  ---
  
  ### Answer by username_1 on 2020-02-26. Score: 1
  
  You need to set a conditional to ensure instalments = 1 for the one time scenario. Instalments = 0 is open ended recurring and any other number is recurring with that number of instalments.
  
  There was a change/PR to the repo that enabled open ended recurring contributions: <https://github.com/colemanw/webform_civicrm/pull/141>
  so now it's even more important than before to ensure `civicrm_1_contribution_1_contribution_installments` is a number and set properly. It's a Number --> No is not a valid value.
  
  Best to keep the Widget: Number -> this is how the component config looks when it's first enabled:
  
  [![enter image description here](https://i.sstatic.net/4oFyF.png)](https://i.sstatic.net/4oFyF.png)
  
  If you want to hide the Element -> change the widget to Hidden and use conditionals to set its value to either 0 or 1 (based on another field).
  
  > **Comments:**
  > **username_0**: My webform question for "I want this to Recur Monthly" has the form key civicrm_1_contribution_1_contribution_installments with the Options default set to Key = 1 Value = No And than I also have the conditional to set that answer to No. Maybe I need to try 1 instead of No?  
  > **username_0**: I just changed my conditional so that it sets that to 1. I ran a donation and it created a recurring contribution.  
  > **username_0**: I also unchecked Required for the installments. I tested it again and it still created a recurring contribution. I looked in the tables and the default there is 1 and the Conditional is to set that to 1 as well. So the tables seem to have the right data. The weird thing is that it used to work properly.  
  > **username_1**: I've added some more detail in the Answer. It' important that civicrm_1_contribution_1_contribution_installments is a number  
  > **username_0**: I have the Key for civicrm_1_contribution_1_contribution_installments as a number (default is 1).  I will edit my question to make it more clear what I am asking.  
  > **username_0**: I have been using it with the Widget as a Select Option on all my forms for more than a year now. I just switched it back to a Number with default 1. It behaves in exactly the same manner. It changes my 1 to a 0 on submission. My answer below is the correct. You cannot use a conditional to hide it unless you want all the submissions to be indefinitely recurring.  
  
  ---
  
  