• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

window.confirm box

 
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a problem with my program.  Whenever I enter a value in my window.confirm (from my function: quantity, price, or item) it come up as undefined. Any suggestions?



 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The "answer" to window.confirm() is returned as the value of the function call. You're not doing anything with it.

Btw, I'd suggest putting the script into a single block rather than one at the beginning and one at the end.
 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The "answer" to window.confirm() is returned as the value of the function call. You're not doing anything with it.

Btw, I'd suggest putting the script into a single block rather than one at the beginning and one at the end.



I'ved changed it to this, but I think that I'm supposed to create a new function here, but how do I call my placeOrder() function to be used here?

 
Marshal
Posts: 4491
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like you have a bracket problem in your function.

Your browser's developer tools would have highlighted this.
 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:It looks like you have a bracket problem in your function.

Your browser's developer tools would have highlighted this.



Yes it does appear that I do, but that being said.  placeOrder() is a function that I used to store arrays.  I need to create a window.confirm box that calls that function.
 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:It looks like you have a bracket problem in your function.

Your browser's developer tools would have highlighted this.



W3 School says to do this:



But I need to call my placeOrder() function so that window.confirm box can have that information....
 
Ron McLeod
Marshal
Posts: 4491
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Daniel Martos wrote:placeOrder() is a function that I used to store arrays.  I need to create a window.confirm box that calls that function.


That is different than what you are doing now.  In your example, you are calling confirm from within the placeOrder() function.  Are you thinking something like this?:
 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Daniel Martos wrote:placeOrder() is a function that I used to store arrays.  I need to create a window.confirm box that calls that function.


That is different than what you are doing now.  In your example, you are calling confirm from within the placeOrder() function.  Are you thinking something like this?:



I guess let me show you the whole thing.  placeOrder() is a function in the heading.

 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The "answer" to window.confirm() is returned as the value of the function call. You're not doing anything with it.

Btw, I'd suggest putting the script into a single block rather than one at the beginning and one at the end.



Bear,  Can I put my confirm in my original placeOrder function?  How do I do that if I can?

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic