# Coding on Wix form.

**URL:** <https://forum.wixstudio.com/t/coding-on-wix-form/26595>\
**Category:** Ask the community\
**Tags:** wix-forms, code, question\
**Created:** [February 7, 2020, 9:31pm UTC](https://forum.wixstudio.com/t/coding-on-wix-form/26595 "2020-02-07T21:31:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alphaveteranwebsite](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/alphaveteranwebsite/32/17133_2.png) [@alphaveteranwebsite](https://forum.wixstudio.com/u/alphaveteranwebsite)\
**Post date:** [February 7, 2020, 9:31pm UTC](https://forum.wixstudio.com/t/coding-on-wix-form/26595/1 "2020-02-07T21:31:23Z")

</div>

Hi.  
I’m using the wix forms, I added some code only for the input fields. Some simple Collapsed and expand. So all the code I wrote works fine. I have 0 lines of code for the submit button, i’m letting the wix form app do it’s own automation for the submission.  
My problem is the submit button does not work. Nothing happens at all.  
I have changed the ID of the submit button twice, in case.  
I have called Wix support. The person said it was a code related problem and it’s being escalated to the coding team. But I cant wait 48h.

[https://www.alphaveterans.ca/home](https://www.alphaveterans.ca/home)

Any button on the site goes to the lightbox with the form.

Here is also my code.

export function Button1\_click(event) {  
if ($w(‘#wixForm1’).collapsed) {  
$w(‘#wixForm1’).expand();  
}  
if ($w(‘#social’).collapsed) {  
$w(‘#social’).expand();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).collapsed) {  
$w(‘#textsocial’).expand();  
}  
if ($w(‘#checkboxGroup2’).collapse) {  
$w(‘#checkboxGroup2’).expand();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).expand) {  
$w(‘#grostext’).collapse();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}

}  
export function Button2\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#therapeute’).collapsed) {  
$w(‘#therapeute’).expand();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).expand) {  
$w(‘#textsocial’).collapse();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).collapsed) {  
$w(‘#checkboxGroup3’).expand();  
}  
if ($w(‘#texttherapeute’).collapsed) {  
$w(‘#texttherapeute’).expand();  
}  
if ($w(‘#grostext’).expand) {  
$w(‘#grostext’).collapse();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}  
}  
export function Button3\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#pairaidant’).collapsed) {  
$w(‘#pairaidant’).expand();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).collapsed) {  
$w(‘#textsocial’).expand();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).collapsed) {  
$w(‘#grostext’).expand();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}  
}  
export function Button4\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#textcover’).collapsed) {  
$w(‘#textcover’).expand();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).expand) {  
$w(‘#textsocial’).collapse();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).collapsed) {  
$w(‘#grostext’).expand();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}  
}  
export function Button5\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#harley’).collapsed) {  
$w(‘#harley’).expand();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).collapsed) {  
$w(‘#textsocial’).expand();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).expand) {  
$w(‘#grostext’).collapse();  
}  
if ($w(‘#checkboxGroup4’).collapsed) {  
$w(‘#checkboxGroup4’).expand();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}  
}  
export function Button6\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).collapsed) {  
$w(‘#infolettre’).expand();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).collapsed) {  
$w(‘#textsocial’).expand();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).expand) {  
$w(‘#grostext’).collapse();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}  
}  
export function Button7\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).collapsed) {  
$w(‘#hrd2kill’).expand();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).collapsed) {  
$w(‘#textsocial’).expand();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).expand) {  
$w(‘#grostext’).collapse();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).collapsed) {  
$w(‘#checkboxGroup5’).expand();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}  
}  
export function Button8\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).collapsed) {  
$w(‘#repos’).expand();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).collapsed) {  
$w(‘#textsocial’).expand();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).collapsed) {  
$w(‘#grostext’).expand();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}  
}  
export function Button9\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).collapsed) {  
$w(‘#salon’).expand();  
}  
if ($w(‘#dress’).expand) {  
$w(‘#dress’).collapse();  
}  
if ($w(‘#textsocial’).expand) {  
$w(‘#textsocial’).collapse();  
}  
if ($w(‘#checkboxGroup1’).expand) {  
$w(‘#checkboxGroup1’).collapse();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).collapsed) {  
$w(‘#grostext’).expand();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).collapsed) {  
$w(‘#textsalon’).expand();  
}  
if ($w(‘#textdress’).expand) {  
$w(‘#textdress’).collapse();  
}  
}  
export function Button10\_click(event) {  
if ($w(‘#wixForms1’).collapsed) {  
$w(‘#wixForms1’).expand();  
}  
if ($w(‘#social’).expand) {  
$w(‘#social’).collapse();  
}  
if ($w(‘#therapeute’).expand) {  
$w(‘#therapeute’).collapse();  
}  
if ($w(‘#pairaidant’).expand) {  
$w(‘#pairaidant’).collapse();  
}  
if ($w(‘#harley’).expand) {  
$w(‘#harley’).collapse();  
}  
if ($w(‘#textcover’).expand) {  
$w(‘#textcover’).collapse();  
}  
if ($w(‘#infolettre’).expand) {  
$w(‘#infolettre’).collapse();  
}  
if ($w(‘#hrd2kill’).expand) {  
$w(‘#hrd2kill’).collapse();  
}  
if ($w(‘#repos’).expand) {  
$w(‘#repos’).collapse();  
}  
if ($w(‘#salon’).expand) {  
$w(‘#salon’).collapse();  
}  
if ($w(‘#dress’).collapsed) {  
$w(‘#dress’).expand();  
}  
if ($w(‘#textsocial’).collapsed) {  
$w(‘#textsocial’).expand();  
}  
if ($w(‘#checkboxGroup1’).collapsed) {  
$w(‘#checkboxGroup1’).expand();  
}  
if ($w(‘#checkboxGroup2’).expand) {  
$w(‘#checkboxGroup2’).collapse();  
}  
if ($w(‘#checkboxGroup3’).expand) {  
$w(‘#checkboxGroup3’).collapse();  
}  
if ($w(‘#texttherapeute’).expand) {  
$w(‘#texttherapeute’).collapse();  
}  
if ($w(‘#grostext’).expand) {  
$w(‘#grostext’).collapse();  
}  
if ($w(‘#checkboxGroup4’).expand) {  
$w(‘#checkboxGroup4’).collapse();  
}  
if ($w(‘#checkboxGroup5’).expand) {  
$w(‘#checkboxGroup5’).collapse();  
}  
if ($w(‘#textsalon’).expand) {  
$w(‘#textsalon’).collapse();  
}  
if ($w(‘#textdress’).collapsed) {  
$w(‘#textdress’).expand();  
}  
}  
Any help is appreciated.

Thx!

---

<div class="post-metadata">

**Author:** ![skmedia](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/skmedia/32/5616_2.png) [@skmedia](https://forum.wixstudio.com/u/skmedia)\
**Post date:** [February 7, 2020, 11:53pm UTC](https://forum.wixstudio.com/t/coding-on-wix-form/26595/2 "2020-02-07T23:53:13Z")

</div>

First, when you’re checking if an element has .expand, it’s going to be **true** always. You’re basically checking whether it has the capacity to expand, not whether it is expanded. You can use the **not** syntax to check that the element is not .collapsed :

```javascript
if (!$w('#id").collapsed)

```

Not sure which one is meant to be your submit button, but it might be better to use code to ensure submit. Also, because I’m having an OCD spike, here’s a much neater way of writing your code 🙂

```javascript
const elems_to_collapse = [
    'wixForms1',
    'social',
    'therapeute',
    //add as needed
],
elems_to_expand = [
    'textdress',
    'textsalon',
    //add as needed
];

export function submit_click() {
    Promise.all([
    //Promise.all ensures an array [] of actions are completed
    elems_to_collapse.forEach(el => {
        if (!$w(`#${el}`).collapsed) $w(`#${el}`).collapse();
    }),
    //action 1 is to collapse elements_to_collapse
    elems_to_expand.forEach(el => {
        if ($w(`#${el}`).collapsed) $w(`#${el}`).expand();
    }),
    //action 2 is to expand elements_to_expand
    $w('#dataset').save()
    //action 3 is to save the data in the form's dataset
    ]).then(() => console.log("saved"))
    //if it works, console will print "saved"
    .catch(e => console.error(e));    
    //if it doesn't, console will display the error
}

```

---

<div class="post-metadata">

**Author:** ![alphaveteranwebsite](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/alphaveteranwebsite/32/17133_2.png) [@alphaveteranwebsite](https://forum.wixstudio.com/u/alphaveteranwebsite)\
**Post date:** [February 8, 2020, 12:14am UTC](https://forum.wixstudio.com/t/coding-on-wix-form/26595/3 "2020-02-08T00:14:49Z")

</div>

Thx David for the response.  
I know the coding is awful, it’s my first time, I watch a tutorial and made it work on my website.  
in response to what you said, I do not have code for the submit button. I’m letting the Wix APP form do it’s automation.  
There’s no reason for the submit button to not work… it’s automated from the App.  
Now for this part  
export function submit\_click() {  
Promise.all([  
elems\_to\_collapse.forEach(el =\> {  
if (!$w(`#${el}`).collapsed) $w(`#${el}`).collapse();  
}),  
elems\_to\_expand.forEach(el =\> {  
if ($w(`#${el}`).collapsed) $w(`#${el}`).expand();  
}),  
$w(‘#dataset’).save()  
]).then(() =\> console.log(“saved”))  
.catch(e =\> console.error(e));  
}

Can you explain what it does?  
thx!

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [February 8, 2020, 2:36am UTC](https://forum.wixstudio.com/t/coding-on-wix-form/26595/4 "2020-02-08T02:36:05Z")

</div>

You will want to make sure that you add the link to refer back to your same post from **yesterday** where you show the picture of the submit button being through your Wix Forms app.  
[https://www.wix.com/corvid/forum/community-discussion/form-not-submitting-when-pressing-on-submit-button](https://www.wix.com/corvid/forum/community-discussion/form-not-submitting-when-pressing-on-submit-button)

**As you submit your form through the submit button on the Wix Forms app there is nothing you can do in code to make this work or not work, you will have to wait until somebody from the Wix Forms team can address this issue and fix this for you.**

However, you can do what David has shown you above and make up your own user input form instead of using the Wix Forms app and use code as you have already and then add your own submit button or use code to save it instead.

See here for creating a user input form with a submit button.  
[https://support.wix.com/en/article/creating-a-form-with-user-input-elements](https://support.wix.com/en/article/creating-a-form-with-user-input-elements)  
[https://support.wix.com/en/article/adding-a-submit-button-to-your-form](https://support.wix.com/en/article/adding-a-submit-button-to-your-form)

See here for the Wix Data API and the Save function.  
[https://www.wix.com/corvid/reference/wix-data.html#save](https://www.wix.com/corvid/reference/wix-data.html#save)

Finally, please make sure that you check the [Forum Guidelines](https://www.wix.com/corvid/forum/community-discussion/corvid-community-guidelines) and take note of using the code block for formatting your code in (like David has done in his reply) and about duplicate posts.

---

<div class="post-metadata">

**Author:** ![skmedia](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/skmedia/32/5616_2.png) [@skmedia](https://forum.wixstudio.com/u/skmedia)\
**Post date:** [February 10, 2020, 12:23am UTC](https://forum.wixstudio.com/t/coding-on-wix-form/26595/5 "2020-02-10T00:23:47Z")

</div>

I added some comments to the original post to explain what each part of the code does!

---

<div class="post-metadata">

**Author:** ![alphaveteranwebsite](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/alphaveteranwebsite/32/17133_2.png) [@alphaveteranwebsite](https://forum.wixstudio.com/u/alphaveteranwebsite)\
**Post date:** [February 10, 2020, 12:37am UTC](https://forum.wixstudio.com/t/coding-on-wix-form/26595/6 "2020-02-10T00:37:54Z")

</div>

@skmedia thx!. I took someone advice and did the forms from scratch. Instead of the premade /automated forms from Wix. Everything works, except the automation of emails. I want to receive an email of the form that was submit. The explanation on the wix website for Wix Data Form Automation, it shows only for 1 form submitted. I have multiple forms. I can make it work with 1 form. But when I choose the option “all forms on website” , nothing works.

---

<div class="post-metadata">

**Author:** ![skmedia](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/skmedia/32/5616_2.png) [@skmedia](https://forum.wixstudio.com/u/skmedia)\
**Post date:** [February 10, 2020, 1:07am UTC](https://forum.wixstudio.com/t/coding-on-wix-form/26595/7 "2020-02-10T01:07:06Z")

</div>

@alphaveteranwebsite Sending automated emails in code requires this other API:  
[https://www.wix.com/corvid/reference/wix-crm.html#emailContact](https://www.wix.com/corvid/reference/wix-crm.html#emailContact)

I think there’s an example up top
