portfolio/src/main/webapp/comments.js
// creates form for adding new comments
creates form for adding new comments
creates form for adding new comments
function createNewCommentForm() {
  fetch('/blobstore-upload-url').then(response => {
    return response.json();
  }).then(data => {
    const formElement = document.createElement('form');
    formElement.method = 'POST';
    formElement.action = data.url;
    formElement.id = 'add-comment-form';
    formElement.enctype = 'multipart/form-data';
    formElement.appendChild(createFormInput('text', 'text', 'Write your comment here'));
    formElement.appendChild(createFormInput('file', 'image', ''));
    formElement.appendChild(createFormInput('submit', '', ''));
    document.getElementById('form-add-comment-div').appendChild(formElement);
  });
}
function createNewCommentForm ( ) { fetch ( '/blobstore-upload-url' ) . then ( response => { return response . json ( ) ; } ) . then ( data => { const formElement = document . createElement ( 'form' ) ; formElement . method = 'POST' ; formElement . action = data . url ; formElement . id = 'add-comment-form' ; formElement . enctype = 'multipart/form-data' ; formElement . appendChild ( createFormInput ( 'text' , 'text' , 'Write your comment here' ) ) ; formElement . appendChild ( createFormInput ( 'file' , 'image' , '' ) ) ; formElement . appendChild ( createFormInput ( 'submit' , '' , '' ) ) ; document . getElementById ( 'form-add-comment-div' ) . appendChild ( formElement ) ; } ) ; }
creates form for adding new comments
creates form for adding new comments
// server returns the action url for the form