add reset event

main v0.2.0
HerrHase 1 week ago
parent 4725bf8ed5
commit b137cec475

@ -39,6 +39,9 @@
<button class="button" type="submit">
Send
</button>
<button class="button" type="reset">
Reset
</button>
</form>
</div>
</div>

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{
"name": "@tiny-components/upload",
"version": "0.1.0",
"version": "0.2.0",
"description": "Upload Field for Riotjs",
"repository": {
"type": "git",

@ -5,9 +5,9 @@ import FieldUpload from './fieldUpload.riot'
riot.register('tiny-field-upload', FieldUpload)
riot.mount('tiny-field-upload')
form.addEventListener('submit', (event) => {
document.querySelector('.form-html').addEventListener('submit', (event) => {
event.preventDefault()
const data = new FormData(event.target);
const data = new FormData(event.target)
console.log(data)
})

@ -57,6 +57,11 @@
{
// getting field for getting files
this.field = this.$(this.state.TINY_FIELD_UPLOAD_FIELD)
// getting closet form-element and add reset
this.root.closest('form').addEventListener('reset', () => {
this.reset()
})
},
/**
@ -136,6 +141,17 @@
if (this.props.max && (this.state.files.length >= this.props.max)) {
this.state.disabled = true
}
},
/**
*
*
*/
reset() {
this.state.files = []
this.validateMax()
this.update()
}
}

Loading…
Cancel
Save