Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am using React based form #213

Closed
AbhimanyuAryan opened this issue Mar 28, 2018 · 5 comments
Closed

I am using React based form #213

AbhimanyuAryan opened this issue Mar 28, 2018 · 5 comments

Comments

@AbhimanyuAryan
Copy link

AbhimanyuAryan commented Mar 28, 2018

I am using ReactJS instead of HTML form

submitDetails(){
    var thisComponent = this;
    $("#"+this.props.submitButton).click(function(){
      console.log(thisComponent.state);

      $.post('https://script.google.com/macros/s/AKfycbwCfsi-UTfR0M2gCziC3E66eB4_F8Tlyztv7v6i3jr03S0tMDPF/exec', thisComponent.state, function(response){
        console.log(response);
    })

    });
  }

but this doesn't seem to work. While sending the data to excel sheet

All attributes are same. The only thing I'm confused b/w is that 'gform' id. I haven't done that. Is that a problem?

When I submit I get an object out which contains data. Now how do it plugin in this data to excel?

@mckennapsean
Copy link
Collaborator

This is for Gsheets, not Excel, but I hope that is clear.

You cannot just post the XHR request unless you parse it first. The JS we include does the parsing and includes a request to the server from the form itself. I am not sure what this.state is to say if y ou are doing that correctly. The gform id is simply used by the JS we include to override the default submit action on the form's button so it parses and sends the data to Google in the correct format. I have heard of reports using React, but I haven't worked to make a MVS to test it against.

@AbhimanyuAryan
Copy link
Author

yaa my bad. GSheet :)

@mckennapsean
Copy link
Collaborator

Also, this may help those using React / Vue / Angular / etc., thought you have to make sure our custom JS is in the framework and overrides the form submission button.

@nelsonic
Copy link
Member

Using React just to submit a simple form is like using a chainsaw to slice bread.
It totally defeats the objective of this (deliberately) simple tutorial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants