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

Submit Button Values not Passing #88

Open
graingerkid opened this issue Oct 2, 2017 · 7 comments
Open

Submit Button Values not Passing #88

graingerkid opened this issue Oct 2, 2017 · 7 comments

Comments

@graingerkid
Copy link

Hey,

Great library!

When I've added this to a form, it works fine, however, I'm passing values on my submit buttons to add further options to the submission, however, these do not get passed along with the form.

Is this by design or a bug? Any way to submit them?

Thanks,
Craig

@paltman
Copy link
Contributor

paltman commented Oct 2, 2017

Do your buttons have name attributes?

@graingerkid
Copy link
Author

graingerkid commented Oct 2, 2017

Yea - if I remove the ajax class it works fine, also.

                  <button class="button is-primary is-outlined next" name="button_action" type="submit" value="tweet">
                    <span class="icon">
                      <i class="fa fa-twitter"></i>
                    </span>
                    <span>Tweet</span>
                  </button>
                  <button class="button is-info is-outlined next" name="button_action" type="submit" value="save">
                    <span class="icon">
                      <i class="fa fa-save"></i>
                    </span>
                    <span>Save</span>
                  </button>

@graingerkid
Copy link
Author

I've tried it as <input ...> fields, too.

@paltman
Copy link
Contributor

paltman commented Oct 2, 2017

Hm...

I just use FormData or jquery’s serialize to capture all the values. I’ll need to read about/dig into those APIs and figure out what’s happening.

@graingerkid
Copy link
Author

ok, thanks for your help

@tentonaxe
Copy link

tentonaxe commented Oct 2, 2017

For reference:
https://stackoverflow.com/questions/4007942/
https://stackoverflow.com/questions/17566315/
It doesn't make sense for either FormData or $.fn.serialize to include that information because those methods can be called at any point in time inside or outside of a click event. that key/value pair has to be added manually.

@paltman
Copy link
Contributor

paltman commented Oct 2, 2017

@tentonaxe thanks for that link. i was just coming back here to post something similar.

I wonder if #81 would allow you to then set hidden inputs.

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