×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I'm not really sure where I can post node questions. I didn't really see a good NODE forum anywhere.
I got throughtthe tutorial on Krengel and decided I wanted to try to build something for fun.
My idea is to build a online golf scorecard
I have a table for courses and a table for scores.
I have been able to get through designing the piece to display courses, add/edit them.
Then I select a course and I load an empty html table to key golfer name(6 empty table rows for this), and scores for each of 18 holes. I have gotten this far
Now here is where I'm stuck.
1. How can I display the total score for the hole(ie, sum the scores of each hole and display on the same page? I can't figure out how I do that calculation in my .pug file.
2. I can't get the submit button on this form to activate my POST
app.get('/scores/keepscore', function(req, res) {
res.render('scores/keepscore', { title: 'ScoreCard' ,form_action: `/scores/update`})
})
app.post('/scores/update', function(req, res) {
console.log('i got to the update')
let stmt = new db.dbstmt(dbconn)
console.log(req)
var sql =
`INSERT INTO ${schema}.SCORECARD (COURSE,GOLFER, GDATE, HOLE1,HOLE2,HOLE3,HOLE4, HOLE5, HOLE6, HOLE7, HOLE8, HOLE9, HOLE10, HOLE11, HOLE12, HOLE13, HOLE14, HOLE15, HOLE16, HOLE17, HOLE18)
VALUES ('${req.body.COURSE}','${req.body.GOLFER}',CURRENT_DATE, ${req.body.HOLER1}, ${req.body.HOLE2}, ${req.body.HOLE3},${req.body.HOLE4}, ${req.body.HOLE5}, ${req.body.HOLE6},
${req.body.HOLE7}, ${req.body.HOLE8}, ${req.body.HOLE9},${req.body.HOLE10}, ${req.body.HOLE11}, ${req.body.HOLE12},${req.body.HOLE13}, ${req.body.HOLE14}, ${req.body.HOLE15},
${req.body.HOLE16}, ${req.body.HOLE17}, ${req.body.HOLE18} ) with NC`
stmt.exec(sql, function(result, err){
console.log(err)
res.redirect('/scores/keepscore')
stmt.close()
})
})
3. How do I get the post to process through the whole HTML table
4. I want to be able to save the table after each hole. With NODE.JS, would I process the insert/update within the same POST action, or is there another method I should be using for this.
5. I'm processing the courses and scores within my index.js. Should this be broken out?
Thanks for any input you might have on this.
Mike
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.