src/scripts/script.js
//Events to try when submitting the form
Events to try when submitting the form
Events to try when submitting the form
submit(event) {
    event.preventDefault()
    try {
      this.validateFields()
      const transaction = this.formatData()
      modal.isEdit ?
        calculateTransactions.saveEdit(transaction, calculateTransactions.underEditionIndex)
        : calculateTransactions.add(transaction)
      this.clearFormFields()
      modal.close()
    }
    catch (error) {
      alert(error.message)
    }
  }
submit ( event ) { event . preventDefault ( ) try { this . validateFields ( ) const transaction = this . formatData ( ) modal . isEdit ? calculateTransactions . saveEdit ( transaction , calculateTransactions . underEditionIndex ) : calculateTransactions . add ( transaction ) this . clearFormFields ( ) modal . close ( ) } catch ( error ) { alert ( error . message ) } }
Events to try when submitting the form
Events to try when submitting the form
//Validate data //Format data //Save data and push to table //Clear form fields