Streaming live at 10am (PST)

Webflow form - Do not send empty checkboxes


#1

Hi there,

I was wondering, if there were a way to ask webflow form not to send empty or unchecked checkboxes per email when a user fills in a form.

I guess my question is:
how to get webflow to remember and send me only the things the user checked or filled ?

Bonus question:
is there a way to tell webflow to write something else than “true” in the email when a checkbox is ticked ? I work for a swiss theater and people speak french… :slight_smile: Instead of “true”, I’d love to write “réservé”. Not sure if that’s possible ?

Thank you !
Anthony


#2

Umm, I guess it really depends on the use of it, as there are various factors to keep in mind.

Would you be so kind and provide with share link? As this would enable people to suggest the better solution.


#3

Hi @Throatscratch,

sure thing, here is my read-only link

Bellow are some screenshot to better explain my sittuation:


#4

Thanks for sharing. Just to clarify on that specific page, when someone “makes reservation” - sorry I don’t know French - user should be able to select only one option right?


#5

Sure thing.

Nope, the idea of those checkboxes, is to allow the user to make multiple choices at a time, meaning the user can already book different date of the event in one single reservation.

Right now, if he doesn’t click on one of the available checkbox, that unchecked checkbox will appear in the email with the value of “false”. Which is probably expected behaviour. But I don’t want to remember the client which date he didn’t chose :slight_smile: therefore I wish to not display those unchecked checkboxes names and values in the confirmation email.


#6

Hmm, I don’t think I can come up with a solution ( Sorry )
Recently I did something similar to your site - where on the application form I had to pull Dates from CMS - and when the user submits the form, it posted its value. The major difference here is that I needed only one option, not multiple and I used radio buttons instead.

As far as I know, Checkbox will send it’s value - from webflow’s end as true or false by default.

As for the required, i used JS with a logic of removing attribute “required”. Script goes along like this

<script>
// Required validation
$(function(){
    var chbxs = $(':radio[required]');
    var namedChbxs = {};
    chbxs.each(function(){
        var name = $(this).attr('name');
        namedChbxs[name] = (namedChbxs[name] || $()).add(this);
    });
    chbxs.change(function(){
        var name = $(this).attr('name');
        var cbx = namedChbxs[name];
        if(cbx.filter(':checked').length>0){
            cbx.removeAttr('required');
        }else{
            cbx.attr('required','required');
        }
    });
});
</script>

I think u might need to tweak script a bit to fit yours, but hopefully, you get the idea. I am definitely not a pro,i hope someone can help you out better.


#7

You… could probably use custom code to delete empty checkboxes upon form submission.


#8

Okies, this is as best as i can get. This is a hack - resulting only removing the unwanted false / true statements.

You can check out the demo page I made

Sharelink: https://preview.webflow.com/preview/magic-land-of-design?preview=1eb54eaf554f2dad777e5073677ef6d6

it’s in the various forms page, check the custom scripts.

**Live Preview to check required fields **: http://magic-land-of-design.webflow.io/various-forms

The result you get in email:


Here Deadpool and Old Boi is selected.

Code is found on g00gl and modified accordingly, I am not the author of scriptage. Therefore there might be better shorter and more logical solutions.
Hope this helps