diff options
| author | Michael Foiani <mfoiani2019@communiyschoolnaples.org> | 2018-07-30 19:29:41 -0400 |
|---|---|---|
| committer | Michael Foiani <mfoiani2019@communiyschoolnaples.org> | 2018-07-30 19:29:41 -0400 |
| commit | 936bbaa65fcb34c415991af95984b6b174f974b8 (patch) | |
| tree | 7faf2c5c3d35014845af36ecbe883390557e9745 /src/components/mao-fourms.js | |
| parent | de1b4edad08812dc7756102f5862596bb2e28528 (diff) | |
Added some icons to tutoring page and fixed bug with empty textbox fields.
Diffstat (limited to 'src/components/mao-fourms.js')
| -rw-r--r-- | src/components/mao-fourms.js | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/components/mao-fourms.js b/src/components/mao-fourms.js index e7398b5..cb7095b 100644 --- a/src/components/mao-fourms.js +++ b/src/components/mao-fourms.js @@ -132,7 +132,7 @@ class MaoFourms extends connect(store)(PageViewElement) { }} _stateChanged(state) { - this.signedIn = state.firebase.signedIn; + this.signedIn = state.firebase.initialized; this.authMessage = state.firebase.authMessage; this.fourmPosts = state.firebase.fourmPosts; @@ -140,17 +140,27 @@ class MaoFourms extends connect(store)(PageViewElement) { } submitFourm() { - if( this.shadowRoot && - confirm('Are you sure you want to submit this to the fourm page? It will be public to everyone.') - ) - { + if(this.shadowRoot) { var subjectElement = this.shadowRoot.getElementById('subject-field'); var contentElement = this.shadowRoot.getElementById('content-field'); - store.dispatch(createFourmPost(subjectElement.value, contentElement.value)); + if(!contentElement.value) { + contentElement.value = ""; + } - subjectElement.value = ""; - contentElement.value = ""; + if( subjectElement.value.trim() === "" || + contentElement.value.trim() === "" + ) + { + alert("Please fill out all fields when creating a form post."); + } else { + if(confirm('Are you sure you want to submit this to the fourm page? It will be public to everyone.')) { + store.dispatch(createFourmPost(subjectElement.value, contentElement.value)); + + subjectElement.value = ""; + contentElement.value = ""; + } + } } } |
