Skip to content
This repository has been archived by the owner. It is now read-only.

Any way to make buttons work automagically like an input type="submit" ? #27

Closed
treeder opened this issue Nov 26, 2014 · 2 comments
Closed

Comments

@treeder
Copy link

@treeder treeder commented Nov 26, 2014

For eg:

<paper-button raised>Submit</paper-button>

Be nice if that would just submit like a normal input submit.

@rnicholus
Copy link
Owner

@rnicholus rnicholus commented Nov 26, 2014

You can either call the submit function on the form via JavaScript or perhaps include an input submit button as a child element of the paper button.

On Tue, Nov 25, 2014 at 6:26 PM, Travis Reeder notifications@github.com
wrote:

For eg:

<paper-button raised>Submit</paper-button>

Be nice if that would just submit like a normal input submit.

Reply to this email directly or view it on GitHub:
#27

@rnicholus
Copy link
Owner

@rnicholus rnicholus commented Nov 26, 2014

Here's a very simple example that assumes the page has only one form:

<paper-button id="submitButton" raised>Submit</paper-button>
<script>
   document.getElementById('submitButton').addEventListener('click', function() {
      document.forms[0].submit(); 
   });
</script>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants