0

I'm trying to get these checkbox fields to match outputs with some other fields I have that have "Yes" and "No" outputs. Any way to change these? Thanks!

Here's some more details... I have a large multipage form that users fill out and submit. After submission it takes the user to a page with a summary of all the information provided in the form. I have some Checkbox fields on the form as well as some Radio buttons. The Radio buttons I can give a value. I have given values of "Yes" and "No". The checkboxes have built-in values of "y,n". I would like to be consistent with the values displayed, and would like the "y,n" values of the checkboxes to be "Yes, No" instead. Thanks for your help!

EE 2.9.3 Freeform Pro 4.2.2

Here's some template code...

This is a checkbox...

                {freeform:field:email_invoice} Email invoice instead of sending via USPS?<br />
                {if freeform:error:email_invoice}
                    <span class="error">{freeform:error:email_invoice}. Please type "NA" if not applicable.</span>
                {/if}

This is a radio button...

                {freeform:field:controlled_substance wrapper_open="" wrapper_close="" row_wrapper_open="" row_wrapper_close="<br />" label_wrapper_open="" label_wrapper_close="" }
                {if freeform:error:controlled_substance}
                    <span class="error">{freeform:error:controlled_substance}</span>
                {/if}

When displaying it after submission I'm using this code...

checkbox...

                <tr><td>    
                Email invoice?: </td><td><strong>{freeform:field:email_invoice}</strong> 
                </td></tr>

radio button...

                <tr><td class="first">  
                Controlled substance?: </td><td><strong>{freeform:field:controlled_substance}</strong>
                </td></tr>
5
  • Can you elaborate more on the question? Do you have some template code to show of what you have up to now? Also, what version of FF and EE are you using? Thanks :)
    – Solspace
    Sep 29, 2015 at 8:19
  • I made some edits... Sep 29, 2015 at 21:25
  • Are you using a checkbox field or a checkbox group field?
    – Solspace
    Sep 30, 2015 at 2:17
  • I'm using a checkbox...I think I see where you are going though...I guess I could use a checkbox group and only have one checkbox value. Sep 30, 2015 at 13:29
  • Actually that wouldn't work either as I can only add one value to the checkbox field. I ended up editing the freeform_ft.checkbox.php file to get the "Yes, No" values I wanted. thanks! Oct 2, 2015 at 14:04

1 Answer 1

0

Well, it's possible you could just modify this file:

/third-party/freeform/default_fields/freeform_ft.checkbox.php

But that seems like a bad decision, and it wouldn't retroactively fix any already-stored form submissions.

I don't know what state you're at in development, but regardless, a simple fix for this is a dual comparison.

{if field_1 == "y" && field_2 == "Yes"}

    // fields are both set to yet

{if:elseif field_1 == "n" && field_2 =="No"}

    // fields are both set to no

{if:else}

    // our fields don't match value intent

{/if}

I assume by match you mean equality comparison in value intent ('y','Y','yes','YES', etc whatever value with the same intent as "yes"). If you could expand on what you're trying to do, I can better help you.

1
  • I added some additional information above, thanks Sep 29, 2015 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.