Skip Navigation

[Resolved] add new checkbox to a pre existing CRED form

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to add a new checkbox to an existing CRED Form, but the value is not saved.

Solution: First, add the checkbox field to an existing Field Group in wp-admin. Then edit the Form. Use the "Add Post Fields" button to insert the new field in the Form.

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by eladY 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#951171

I'm trying to add new checkbox to a pre existing CRED form,
I can see the checkbox in the form but the value isn't getting to the form submission results
here is the checkbox i'm trying to add (labels are in Hebrew):

[cred_generic_field field='add_to_newsletter' post='contactformsrecords' value='' type='checkbox' class='form-control' urlparam='' output='bootstrap']
{
"required":0,
"validate_format":0,
"checked":0,
"default":"אני מאשר הוספה לרשימת הניוזלטר",
"label":"הוסף אותי לרשימת הניוזלטר"
}
[/cred_generic_field]

and here is all of the code for the form:

[credform class='cred-form cred-keep-original']
<div class="FooterForm">
  <div class="form-group form-groupFullW">
    [cred_field field='myfirstname' post='contactformsrecords' value='' urlparam='' placeholder='שם פרטי' class='form-control' output='bootstrap']
    [cred_field field='mylastname' post='contactformsrecords' value='' urlparam='' placeholder='שם משפחה' class='form-control' output='bootstrap']
  </div>
    <div class="form-group form-groupFullW">[cred_field field='myphone' post='contactformsrecords' value='' urlparam='' placeholder='מספר טלפון' class='form-control' output='bootstrap']
      [cred_field field='myemail' post='contactformsrecords' value='' urlparam='' placeholder='דואר אלקטרוני' class='form-control' output='bootstrap']
	</div>
  <div class="form-group form-groupFullW">
	[cred_field field='lead-subject' post='contactformsrecords' value='' urlparam='' class='form-control' output='bootstrap']
  </div>
  <div class="form-group form-groupFullW">
   [cred_field field='post_excerpt' post='contactformsrecords' value='' urlparam='' class='form-control' output='bootstrap']
  </div>
  <div class="add_to_newsletter form-group form-groupFullW">
  [cred_generic_field field='add_to_newsletter' post='contactformsrecords' value='' type='checkbox' class='form-control' urlparam='' output='bootstrap']
{
"required":0,
"validate_format":0,
"checked":0,
"default":"אני מאשר הוספה לרשימת הניוזלטר",
"label":"הוסף אותי לרשימת הניוזלטר"
}
[/cred_generic_field]
    <div style="visibility: hidden; height: 2px;">
      [cred_field field='post_excerpt' post='contactformsrecords' value='' urlparam='' class='form-control' output='bootstrap']
      [cred_field field='contactsorce' post='contactformsrecords' value='[wpv-post-title output="sanitize"]' urlparam='' class='form-control' output='bootstrap']
      [cred_field field='contactsorceurl' post='contactformsrecords' value='[wpv-post-url]' urlparam='' class='form-control' output='bootstrap']
      [cred_field field='cc-name' post='contactformsrecords' value='מנהל אתר' urlparam='' class='form-control' output='bootstrap']
      [cred_field field='lead-sorce-form' post='contactformsrecords' value='Contact-Page-Form' urlparam='' class='form-control' output='bootstrap']
    </div>
    [cred_field field='form_messages' value='' class='alert alert-warning']
    <p style="text-align: left;">[cred_field field='form_submit' value='שלח' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']</p>
</div>
[/credform]
#951513

I can see the checkbox in the form but the value isn't getting to the form submission results
Okay I can see you have added a generic field. In order to save the value of a generic field, you must use custom code. If you do not want to write custom code, you can add the checkbox field to the Field Group for this post type, and rebuild the Form. Can you explain where you want to save the generic field value?

#954304

Hi
Christian,
thank you for your replay
I'v change the field from generic field to checkbox field as you suggested and it's working now, what i missed in first was that I needed first to add the field to the relevant custom fields group.
thank you,
have a nice day