Created
February 12, 2015 19:20
-
-
Save frankiefu/67fdb6fad95068a29da7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form is="ajax-form" action="test" method="post"> | |
<paper-radio-group id="wifi" selected="always"> | |
<paper-radio-button name="always" label="Always"></paper-radio-button> | |
<paper-radio-button name="pluggedin" label="Only when plugged in"></paper-radio-button> | |
<paper-radio-button name="never" label="Never"></paper-radio-button> | |
</paper-radio-group> | |
<input type="submit"> | |
</form> | |
<script> | |
var wifi = document.getElementById('wifi'); | |
document.querySelector('form').addEventListener('submitting', function(e) { | |
var formData = e.detail.formData; | |
if (!wifi.selected) { | |
console.log('validation error') | |
} else { | |
formData[wifi.id] = wifi.selected; | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment